Ant Design Svelte

Spin

Waiting indicators: size, delay, percentage and full screen mode.

When to use

Spin shows waiting without a known volume or updating already available data. It can stand alone, wrap around content, or take up the screen. For the primary page structure, Skeleton is suitable, for a measurable percentage - Progress or numerical percent Spin.

Standby mode and contents

spinning controls wait and defaults to true. description specifies an explanation with text or snippet. size accepts small/medium/large. children allows you to store data under the wait layer.

Problem Opportunity Example
Show individual status spinning, available name Main indicator
Update fields without losing your draft children Nested mode
Do not show short indicator delay Delay
Replace wait pattern indicator snippet Your own indicator
Transfer percentage number or auto Percent
Occupy screen with standby layer fullscreen Full screen mode

In nested mode, children remain in the DOM. While waiting, the content gets inert and aria-busy; the draft is saved, the temporarily unavailable focus is processed by the component. This is different from Skeleton, which replaces children.

Delay, percentage and completion

delay is measured in milliseconds and delays the appearance of the indicator. The requested spinning blocks the nested content immediately. If you end the wait before the delay expires, the indicator will not appear.

Numeric percent must come from the application. auto simulates motion until the wait ends and does not measure network or processing. For success, error and cancellation, change the spinning according to the result of the operation; the component itself does not launch it.

Profile update saves the draft and shows a replay error. Cancellation and leaving the page are protected from late results. The fullscreen example's timer is cleared when unmounted; it is a demo, no mandatory waiting period for Spin.

fullscreen, indicator and theme

fullscreen - a fixed layer in the current DOM branch, without portal and focus trap. It is not a full-fledged modal window. Place a clear cancel action outside of blocked content or ensure that the operation completes.

indicator - passive Svelte snippet with class/style, prefixCls and percent. The general option can be set via ConfigProvider.spin. Spin.setDefaultIndicator exists, but the setter does not update already mounted instances; for a reactive and isolated setup, use provider.

classNames/styles are styled root/section/indicator/description/container; styles is set by CSS strings. Spin design tokens control the size of the dots and the height of the area. Standard indicators and available content are displayed with SSR; delay, auto and controls start working after hydration.

A non-empty local prefixCls specifies the Spin CSS classes and is passed to the custom indicator in info.prefixCls. The empty string and undefined inherit ConfigProvider.prefixCls with the -spin suffix, defaulting to ant-spin. delay, loading state and namespace CSS variables are independent of class changes. Example ConfigProvider shows inheritance.

Examples

Normal loading

Independent status with an accessible name.

small
medium
large

Dimensions

small, medium and large.

The value is saved after loading.

Loading existing content

The draft remains in the DOM.

Data preparationThis will take a few seconds.
Section contents.

Description of waiting

Description via Svelte Snippet.

The indicator appears after 500 ms. Canceling before this date will not show it.

Appearance delay

Wait 500ms and cancel explicitly.

Your own indicator

Snippet locally and via ConfigProvider.spin.

Processing files
Auto shows the conditional progress of expectations and does not measure real tasks.

Load percentage

Measurable percentage and conditional auto mode.

Styles object
Document with frame.
Styles function
Styles depend on props.

Semantic DOM

Styles object and function.

Full screen wait

The example closes after two seconds.

Document preparation
Nested topic and RTL direction.

Tokens and RTL

Sizes of points and height of loading area.

small
medium
large

Changes in the card: 0. Data version: 0.

Измените черновик и обновите данные.

Profile update

Success, error, redo, cancel and save draft.

API

Nine themes of the official ant.design 6.7.0 page are mapped to the public Svelte API.

Example themes
ThemeExample or limitation
Basic UsageA separate indicator with an accessible name.
Sizesmall, medium and large.
Embedded modeSave a draft and lock the occupied area.
Customized descriptionDescription via Svelte Snippet.
DelayDelay appearance and cancellation.
Custom spinning indicatorLocal indicator and ConfigProvider.spin.
ProgressKnown percentage and explicitly enabled auto.
Custom semantic dom stylingObject and callback styles.
FullscreenFull screen waiting with automatic completion.

Spin

PropertyDescriptionTypeDefault
prefixClsFull local CSS prefix for Spin and its states; is also transmitted to indicator info. The empty string and undefined inherit ConfigProvider.prefixCls; default is ant-spin.stringConfigProvider + -spin
spinningRequested wait state.booleantrue
delayAppearance delay in milliseconds. Content is blocked immediately.number0
sizeIndicator size.small | medium | largemedium
descriptionText or Snippet description.SpinContent—
indicatorPassive indicator; gets class/style, prefixCls and percent.Snippet<[SpinIndicatorInfo]> | nullfour points
percentCircular percentage or conditional waiting course.number | auto—
fullscreenFixed layer in the current DOM branch.booleanfalse
childrenThe contents of the nested mode are stored in the DOM.SpinContent—
classNamesNamed element classes, including root.SpinSemanticSlots | callback—
stylesCSS lines; callback gets the current props.SpinSemanticSlots | callback—
nativeElementbind:nativeElement gets the root after mount.HTMLDivElement—
refbind:ref with the nativeElement field.SpinRef—

indicator - Snippet with SpinIndicatorInfo parameters; description/children accept text and Snippet. ConfigProvider.spin specifies common classes, styles and indicator.

Semantic DOM

A separate visible Spin reports status; the nested one has group, status descriptions and inert/aria-busy for container. The content is not unmounted. Mask is an additional slot for the full-screen layer.

Spin
SlotPurpose
rootRoot of single, nested or full screen mode.
sectionIndicator and description area.
indicatorStandard or custom icon.
descriptionText below the indicator.
containerSaved content with inert and aria-busy.

Registration tokens

ConfigProvider.theme.components.Spin sets four tokens. colorPrimary controls the standard indicator; fullscreen uses a mask color and a base layer of the flyout elements.

TokenPurpose
contentHeightMaximum height of the indicator area in nested mode.
dotSizeRegular icon.
dotSizeSMSmall icon.
dotSizeLGLarge icon.
Common tokens of the current topic
TokenMeaning
colorPrimary#2f54eb
colorBgMaskrgba(0,0,0,0.45)
colorBgContainer#ffffff
colorTextDescriptionrgba(0,0,0,0.45)
fontSize14
zIndexPopupBase1000

FAQ

Do fields disappear when waiting?

No. The nested DOM is preserved and becomes inert and aria-busy; the draft remains.

What does delay control?

Only the appearance of the indicator. The requested spinning blocks the content immediately.

Does auto measure actual load?

No. For actual volume, pass a number.

How to replace the indicator for an area?

Use ConfigProvider.spin. A static setter does not update already mounted instances.

fullscreen create a modal window?

No. This is a fixed layer without portal or focus trap.

What works without JavaScript?

The server displays standard indicators and content. Delays, auto and control work after hydration.