Ant Design Svelte

Skeleton

Initial loading frameworks: text, avatar and independent elements.

When to use

Skeleton shows the expected structure on initial load: place of avatar, title, text or card. It helps preserve the composition until the data appears. To update already shown content, Spin is suitable, which preserves its DOM.

Frame structure and independent elements

The main Skeleton contains a title and paragraph, and an avatar if necessary. The title object specifies the width, the paragraph defines the rows and width. The width array specifies individual lines; single width refers to the last row.

Problem Opportunity Example
Reserve text block title, paragraph Main frame
Add avatar and different widths settings objects Composite structure
Explicitly enable motion active Animation
Show element form selected exports Elements
Switch frame and data loading, children Replacing content
Separate initial boot and update Skeleton and Spin Application scenario

SkeletonAvatar, SkeletonButton, SkeletonInput, SkeletonImage and SkeletonNode are imported separately. Node accepts a snippet of its own decorative content. These are placeholders: they are not real buttons or fields and do not receive focus.

loading, status and availability

loading is true by default. While it is enabled, children are replaced by the frame and unmounted. When loading:false, the child snippet is output. Keep the state that should survive such a replacement in the parent model.

When requesting again, it is not necessary to delete the finished card again. Application example shows Skeleton to first response, then Spin to update and save content. Error and cancellation are controlled by the application.

The frame is decorative, the available loading message refers to its host. Pass the friendly name of the scope if there are multiple loads on the page. Don't put an interactive cancel button inside a decorative placeholder: it should remain an accessible control in its own right.

Geometry and design

round changes the rounding of lines and headers. active enables animation; prefers-reduced-motion leaves a static frame. Choose the shape and size of independent elements based on the future content to reduce layout jumps. The

For the main Skeleton, class/style refers to the native host, semantic root refers to the decorative frame. For independent elements, style refers to the content, styles.root refers to the outer wrapper. This distinction is important when setting width and padding.

ConfigProvider.skeleton specifies general class/style and semantic defaults. The main frame has root/header/section/avatar/title/paragraph available, while independent elements have root/content. styles contains CSS strings. Skeleton component design tokens change colors, sizes, and paddings; native placeholder-ref is missing when loading:false.

Skeleton and standalone SkeletonAvatar/Button/Input/Image/Node inherit ConfigProvider.prefixCls with the suffix -skeleton, default ant-skeleton. A non-empty local prefixCls takes precedence; an empty string returns the provider's fallback. Service host/status, canonical markers and namespace CSS variables are saved. Example of a common prefix includes the main frame and all five elements.

Examples

Loading…

Regular frame

Title and lines of text.

Loading…

Composite frame

Avatar, width of title and individual lines.

Loading…

Animation

Explicit control of active.

Independent elements

Button, Avatar, Input, Image and Node.

When loading=true this fragment is replaced by a frame. The title model is stored in the parent.

Replacing contents

loading switches frame and child Snippet.

  • Loading…
  • Loading…
  • Loading…

List

Several list lines before and after loading.

Loading…
Loading…

Semantic DOM

Different slots of the main frame and elements.

Loading…

Tokens and RTL

Colors, sizes and paddings in the nested theme.

Card data has not been loaded yet.

Загрузите карточку участника.

Initial download and update

Skeleton on first response, Spin on update, error and cancellation.

API

Seven ant.design 6.7.0 example themes verified against public exports and Skeleton family types.

Example themes
ThemeExample or limitation
BasicHeading and paragraph lines.
Complex combinationAvatar and line geometry.
Active AnimationControlled animation with reduced motion.
Button/Avatar/Input/Image/NodeAll five independent elements.
Contains sub componentReplacing content with a frame.
ListList element frames.
Custom semantic dom stylingMain Skeleton object and function; root/content elements.

Skeleton

PropertyDescriptionTypeDefault
prefixClsFull local CSS prefix for the main Skeleton framework. The empty string and undefined inherit ConfigProvider.prefixCls; the default is ant-skeleton.stringConfigProvider + -skeleton
loadingReplaces children with a frame; false prints children.booleantrue
activeGradient animation.booleanfalse
roundHeader and row rounding.booleanfalse
avatarAvatar display and geometry.boolean | SkeletonAvatarPropsfalse
titleHeader display and width.boolean | SkeletonTitlePropstrue
paragraphDisplay, number and width of lines.boolean | SkeletonParagraphPropstrue
childrenContent after download.Snippet—
classNamesBasic frame classes.SkeletonSemanticSlots | callback—
stylesCSS lines of the main framework.SkeletonSemanticSlots | callback—
nativeElementbind:nativeElement — placeholder after mount; when loading=false it is cleared.HTMLDivElement—

SkeletonTitleProps

PropertyDescriptionTypeDefault
widthHeader width in px or CSS length.number | stringaccording to frame composition

SkeletonParagraphProps

PropertyDescriptionTypeDefault
rowsNumber of lines.numberaccording to frame composition
widthAn array defines each row; single value - last.number | string | (number | string)[]according to frame composition

General properties of elements

PropertyDescriptionTypeDefault
prefixClsFull local CSS prefix of the independent Skeleton and its content. The empty string and undefined inherit ConfigProvider.prefixCls; the default is ant-skeleton.stringConfigProvider + -skeleton
activeAnimation of an independent element.booleanfalse
styleStyles internal content, not external root.string—
classNamesObject with root and content.SkeletonElementSlots—
stylesCSS lines root and content; callback is not supported.SkeletonElementSlots—

SkeletonAvatar

PropertyDescriptionTypeDefault
sizeAvatar size.small | medium | large | numbermedium
shapeAvatar form.circle | squarecircle

SkeletonButton

PropertyDescriptionTypeDefault
sizeButton frame height.small | medium | largemedium
shapeButton shape.default | square | round | circledefault
blockAll available widths.booleanfalse

SkeletonInput

PropertyDescriptionTypeDefault
sizeField frame height.small | medium | largemedium
blockAll available widths.booleanfalse

SkeletonNode

PropertyDescriptionTypeDefault
childrenAny decorative figure.Snippetstandard placeholder

React Skeleton.Avatar/Button/Input/Image/Node are available as separate Svelte exports. For the main Skeleton semantic, parameters take an object or a function, for independent elements - only an object.

Semantic DOM

Native host of the main Skeleton reports group, aria-busy and boot status. Decorative markings are hidden from assistive technologies. Independent elements are also decorative and are not interactive controls.

Skeleton
SlotPurpose
rootDecorative frame inside the native host.
headerAvatar area.
sectionText area.
avatarAvatar figure.
titleHeading.
paragraphList of strings.
Avatar / Button / Input / Image / Node
SlotPurpose
rootOuter wrapper of an independent element.
contentDecorative figure.

Registration tokens

There are six current tokens available in ConfigProvider.theme.components.Skeleton. gradientFromColor and gradientToColor set the colors of the gradient.

TokenPurpose
gradientFromColorStarting color of the gradient.
gradientToColorThe final color of the gradient.
titleHeightHeader height.
blockRadiusRadius of figures.
paragraphMarginTopParagraph indent.
paragraphLiHeightRow height.
Common tokens of the current topic
TokenMeaning
controlHeight32
controlHeightSM24
controlHeightLG40
controlHeightXS16
borderRadiusSM4
padding16

FAQ

When to choose Skeleton and when to Spin?

Skeleton - for the expected initial boot structure. Spin - to update already shown data while preserving the DOM.

Are children saved when loading:true?

No, they are unmounted. Store important data above the component.

Why do style and styles.root belong to different nodes?

The main Skeleton style is designed by the host, the semantic root is the frame. For elements, style decorates the content, root — the wrapper.

Is SkeletonButton a real button?

No. All independent Skeleton elements are decorative and do not participate in the Tab order.

How to disable animation?

Do not enable active. System reduced motion also disables movement.