When loading=true this fragment is replaced by a frame. The title model is stored in the parent.
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
Regular frame
Title and lines of text.
<script lang="ts">
import { Skeleton } from '@woodger/antd';
</script>
<Skeleton aria-label={("Initial loading of article")} />
Composite frame
Avatar, width of title and individual lines.
<script lang="ts">
import { Skeleton } from '@woodger/antd';
</script>
<Skeleton avatar={{ size: 48, shape: 'square' }} title={({ width: '45%' })}
paragraph={{ rows: 4, width: ['100%', '90%', '100%', '60%'] }} round
aria-label={("Initial profile loading")} />
Animation
Explicit control of active.
<script lang="ts">
import { Checkbox, Skeleton } from '@woodger/antd';
let active = $state(true);
</script>
<style>
.settings { margin-bottom: 24px; }
</style>
<div
class="settings"
><Checkbox
bind:checked={active}
>{("Wireframe animation")}</Checkbox></div>
<Skeleton {active} avatar aria-label={("Animated loading")} />
Independent elements
Button, Avatar, Input, Image and Node.
<script lang="ts">
import { Checkbox, RadioGroup, SkeletonAvatar, SkeletonButton, SkeletonInput,
SkeletonImage, SkeletonNode, type SkeletonElementSize } from '@woodger/antd';
let active = $state(true);
let block = $state(false);
let size = $state<SkeletonElementSize>('medium');
let buttonShape = $state<'default' | 'square' | 'round' | 'circle'>('default');
let avatarShape = $state<'circle' | 'square'>('circle');
</script>
<style>
.settings {
display: grid;
gap: 16px;
margin-bottom: 24px;
}
.options {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
.elements {
display: grid;
gap: 24px;
}
.row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 24px;
}
</style>
<div class="settings">
<div
class="options"
><Checkbox
bind:checked={active}
>{("Animation of elements")}</Checkbox>
<Checkbox bind:checked={block}>{("Full width")}</Checkbox></div>
<RadioGroup
aria-label={("Skeleton elements size")}
bind:value={size}
options={(['small', 'medium', 'large'])}
/>
<RadioGroup
aria-label={("Skeleton Button Shape")}
bind:value={buttonShape}
options={(['default', 'square', 'round', 'circle'])}
/>
<RadioGroup
aria-label={("Skeleton Avatar Form")}
bind:value={avatarShape}
options={(['circle', 'square'])}
/>
</div>
<div class="elements">
<SkeletonButton {active} {block} {size} shape={buttonShape} />
<SkeletonInput {active} {block} {size} />
<div class="row"><SkeletonAvatar {active} {size} shape={avatarShape} /><SkeletonImage {active} />
<SkeletonNode {active}><svg width="48" height="48" viewBox="0 0 48 48" aria-hidden="true">
<path d="M8 38V24h8v14zm12 0V10h8v28zm12 0V18h8v20z" fill="currentColor" />
</svg></SkeletonNode></div>
</div>
Replacing contents
loading switches frame and child Snippet.
<script lang="ts">
import { Checkbox, Input, Skeleton } from '@woodger/antd';
let loading = $state(false);
let title = $state<string | undefined>(("Finished article"));
</script>
<style>
.settings { margin-bottom: 24px; }
.article {
display: grid;
gap: 16px;
}
p { margin: 0; }
</style>
<div
class="settings"
><Checkbox
bind:checked={loading}
>{("Show article frame")}</Checkbox></div>
<Skeleton {loading} active avatar aria-label={("Article")}>
<div class="article"><Input aria-label={("Article title")} bind:value={title} />
<p>{("When loading=true this fragment is replaced by a frame. The title model is stored in the parent.")}</p></div>
</Skeleton>
- Loading…
- Loading…
- Loading…
List
Several list lines before and after loading.
<script lang="ts">
import { Checkbox, Skeleton } from '@woodger/antd';
let loading = $state(true);
const articles = ["Project setup", "Working with components", "Library publication"];
</script>
<style>
.settings { margin-bottom: 24px; }
ul {
display: grid;
gap: 24px;
padding: 0;
margin: 0;
list-style: none;
}
li {
padding-bottom: 24px;
border-bottom: 1px solid var(--ant-color-border-secondary);
}
h3 { margin: 0 0 12px; }
p { margin: 0; }
</style>
<div
class="settings"
><Checkbox
bind:checked={loading}
>{("Loading list of articles")}</Checkbox></div>
<ul>
{#each articles as article (article)}<li>
<Skeleton {loading} avatar paragraph={{ rows: 2 }} aria-label={("Loading: " + String((article)) + "")}>
<h3>{(article)}</h3><p>{("Practical project guide.")}</p>
</Skeleton>
</li>{/each}
</ul>
Semantic DOM
Different slots of the main frame and elements.
<script lang="ts">
import { ConfigProvider, Skeleton, SkeletonButton } from '@woodger/antd';
</script>
<style>
.examples {
display: grid;
gap: 24px;
}
</style>
<ConfigProvider skeleton={{ styles: { root: 'padding: 16px' } }}>
<div class="examples">
<Skeleton avatar classNames={{ root: 'skeleton-object' }}
styles={{
root: `
border: 1px dashed #d48806;
border-radius: 8px;
`,
title: 'height: 22px'
}}
aria-label={("Skeleton object")} />
<Skeleton classNames={{ root: 'skeleton-function' }}
styles={({ props }) => ({ title: props.avatar ? '' : 'height: 24px' })}
aria-label={("Skeleton function")} />
<SkeletonButton classNames={{ root: 'skeleton-element' }}
styles={{
root: 'padding: 12px',
content: `
width: 120px;
height: 36px;
`
}} />
</div>
</ConfigProvider>
Tokens and RTL
Colors, sizes and paddings in the nested theme.
<script lang="ts">
import { ConfigProvider, Skeleton, SkeletonButton } from '@woodger/antd';
</script>
<style>
.examples {
display: grid;
gap: 24px;
}
</style>
<ConfigProvider direction="rtl" theme={{
components: {
Skeleton: {
gradientFromColor: '#fff1b8', gradientToColor: '#ffe58f', titleHeight: 22,
blockRadius: 8, paragraphMarginTop: 20, paragraphLiHeight: 18
}
}
}}>
<div class="examples">
<Skeleton active avatar paragraph={{ rows: 3 }} aria-label={("Thematic frame")} />
<SkeletonButton active block />
</div>
</ConfigProvider>
Card data has not been loaded yet.
Initial download and update
Skeleton on first response, Spin on update, error and cancellation.
SkeletonExample.svelte<script lang="ts"> import { onDestroy, tick } from 'svelte'; import { Alert, Button, Checkbox, Input, InputNumber, Skeleton, Spin } from '@woodger/antd'; import { createSpinLoad } from './spin-load.model.svelte'; const model = createSpinLoad(); let hasData = $derived(model.revision > 0); let active = true; let animated = $state(true); let avatar = $state(true); let title = $state(true); let paragraph = $state(true); let round = $state(false); let rows = $state<number | null>(3); let name = $state<string | undefined>(("Anna")); let notifications = $state(true); let edits = $state(0); let result = $derived( model.loading ? hasData ? "Card is being updated..." : "Card loading..." : model.status === 'error' ? "Failed to load card." : model.status === 'cancelled' ? "Card loading cancelled." : hasData ? `Card loaded. Version: ${model.revision}.` : "Download your membership card." ); async function cancel() { if (!model.cancel()) { return; } await tick(); if (active) { const startButton = document.getElementById('skeleton-example-start'); startButton?.focus({ preventScroll: true }); } } async function retryLoad() { if (!model.load()) { return; } await tick(); if (active && model.loading) { const card = document.getElementById('showcase-skeleton'); card?.focus({ preventScroll: true }); } } function reset() { model.reset(); name = ("Anna"); notifications = true; edits = 0; } onDestroy(() => { active = false; model.destroy(); }); </script> <style> .controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; } .preview { margin-block: 24px; padding: 20px; border: 1px solid var(--ant-color-border-secondary); border-radius: var(--ant-border-radius-lg); } .rows { display: flex; align-items: center; gap: 8px; } .card { display: grid; gap: 16px; min-height: 190px; padding: 20px; border: 1px solid var(--ant-color-border-secondary); border-radius: var(--ant-border-radius-lg); } .card p { margin: 0; } .draft { max-width: 340px; } .profile { margin-block: 24px; } output { display: block; margin-top: 20px; color: var(--ant-color-text-secondary); } </style> {#snippet retry()} <Button onclick={() => { void retryLoad(); }}> {("Repeat card loading")} </Button> {/snippet} <div class="controls" ><Checkbox bind:checked={animated} >{("Skeleton Animation")}</Checkbox><Checkbox bind:checked={avatar} >{("Avatar Skeleton")}</Checkbox><Checkbox bind:checked={title} >{("Skeleton Header")}</Checkbox><Checkbox bind:checked={paragraph} >{("Skeleton paragraph")}</Checkbox><Checkbox bind:checked={round} >{("Fillet Skeleton")}</Checkbox><label class="rows" >{("Skeleton Strings")}<InputNumber aria-label={("Skeleton Strings")} bind:value={rows} min={0} max={10} precision={0} /></label></div> <div class="preview"><Skeleton active={animated} {avatar} title={title} paragraph={paragraph ? { rows: rows ?? 3 } : false} {round} aria-hidden /></div> <div class="controls"><Button id="skeleton-example-start" type="primary" loading={model.loading} onclick={() => model.load()} >{("Download card")}</Button><Button disabled={model.loading} onclick={() => model.load('fast')} >{("Quick response cards")}</Button><Button disabled={model.loading} onclick={() => model.load('error')} >{("Card loading error")}</Button><Button disabled={!model.loading} onclick={() => { void cancel(); }} >{("Cancel card loading")}</Button><Button onclick={reset} >{("Reset Skeleton example")}</Button></div> <div class="profile"> <Skeleton loading={model.loading && !hasData} active avatar paragraph={{ rows: 3 }} aria-label={("Member profile")} id="showcase-skeleton" > {#if hasData} <Spin spinning={model.loading} delay={200} description={("Updating the card...")} aria-label={("Loaded card")} id="skeleton-example-refresh" > <div class="card" ><label for="skeleton-example-name" >{("Name on Skeleton card")}</label><div class="draft" ><Input id="skeleton-example-name" bind:value={name} /></div><Checkbox bind:checked={notifications} > {("Card notifications")} </Checkbox><p>{("Changes in the card: ")}{edits}{(". Data version: ")}{(model.revision)}.</p><div class="controls" ><Button onclick={() => { edits++; }} >{("Change Skeleton card")}</Button><Button onclick={() => model.load()} >{("Update downloaded card")}</Button></div></div> </Spin> {:else}<p>{("Card data has not been loaded yet.")}</p>{/if} </Skeleton> </div> {#if model.status === 'error'}<Alert type="error" title={("Card loading error")} description={(hasData ? "Draft saved. Please try the update again." : "Try loading the card again.")} action={retry} showIcon />{/if} <output aria-label={("Skeleton example result")}>{result}</output>spin-load.model.svelte.tstype LoadStatus = 'idle' | 'loading' | 'ready' | 'error' | 'cancelled'; export type SpinLoadKind = 'normal' | 'fast' | 'error'; export function createSpinLoad() { let state = $state.raw<{ status: LoadStatus; revision: number }>({ status: 'idle', revision: 0 }); let timer: ReturnType<typeof setTimeout> | undefined; let generation = 0; let active = true; function clear() { generation++; clearTimeout(timer); timer = undefined; } return { get status() { return state.status; }, get loading() { return state.status === 'loading'; }, get revision() { return state.revision; }, load(kind: SpinLoadKind = 'normal') { if (!active || state.status === 'loading') { return false; } clear(); const current = generation; state = { ...state, status: 'loading' }; timer = setTimeout(() => { if (!active || current !== generation) { return; } timer = undefined; state = kind === 'error' ? { ...state, status: 'error' } : { status: 'ready', revision: state.revision + 1 }; }, kind === 'fast' ? 50 : 700); return true; }, cancel() { if (state.status !== 'loading') { return false; } clear(); state = { ...state, status: 'cancelled' }; return true; }, reset() { clear(); state = { status: 'idle', revision: 0 }; }, destroy() { active = false; clear(); } }; }
API
Seven ant.design 6.7.0 example themes verified against public exports and Skeleton family types.
| Theme | Example or limitation |
|---|---|
| Basic | Heading and paragraph lines. |
| Complex combination | Avatar and line geometry. |
| Active Animation | Controlled animation with reduced motion. |
| Button/Avatar/Input/Image/Node | All five independent elements. |
| Contains sub component | Replacing content with a frame. |
| List | List element frames. |
| Custom semantic dom styling | Main Skeleton object and function; root/content elements. |
Skeleton
| Property | Description | Type | Default |
|---|---|---|---|
prefixCls | Full local CSS prefix for the main Skeleton framework. The empty string and undefined inherit ConfigProvider.prefixCls; the default is ant-skeleton. | string | ConfigProvider + -skeleton |
loading | Replaces children with a frame; false prints children. | boolean | true |
active | Gradient animation. | boolean | false |
round | Header and row rounding. | boolean | false |
avatar | Avatar display and geometry. | boolean | SkeletonAvatarProps | false |
title | Header display and width. | boolean | SkeletonTitleProps | true |
paragraph | Display, number and width of lines. | boolean | SkeletonParagraphProps | true |
children | Content after download. | Snippet | — |
classNames | Basic frame classes. | SkeletonSemanticSlots | callback | — |
styles | CSS lines of the main framework. | SkeletonSemanticSlots | callback | — |
nativeElement | bind:nativeElement — placeholder after mount; when loading=false it is cleared. | HTMLDivElement | — |
SkeletonTitleProps
| Property | Description | Type | Default |
|---|---|---|---|
width | Header width in px or CSS length. | number | string | according to frame composition |
SkeletonParagraphProps
| Property | Description | Type | Default |
|---|---|---|---|
rows | Number of lines. | number | according to frame composition |
width | An array defines each row; single value - last. | number | string | (number | string)[] | according to frame composition |
General properties of elements
| Property | Description | Type | Default |
|---|---|---|---|
prefixCls | Full local CSS prefix of the independent Skeleton and its content. The empty string and undefined inherit ConfigProvider.prefixCls; the default is ant-skeleton. | string | ConfigProvider + -skeleton |
active | Animation of an independent element. | boolean | false |
style | Styles internal content, not external root. | string | — |
classNames | Object with root and content. | SkeletonElementSlots | — |
styles | CSS lines root and content; callback is not supported. | SkeletonElementSlots | — |
SkeletonAvatar
| Property | Description | Type | Default |
|---|---|---|---|
size | Avatar size. | small | medium | large | number | medium |
shape | Avatar form. | circle | square | circle |
SkeletonButton
| Property | Description | Type | Default |
|---|---|---|---|
size | Button frame height. | small | medium | large | medium |
shape | Button shape. | default | square | round | circle | default |
block | All available widths. | boolean | false |
SkeletonInput
| Property | Description | Type | Default |
|---|---|---|---|
size | Field frame height. | small | medium | large | medium |
block | All available widths. | boolean | false |
SkeletonNode
| Property | Description | Type | Default |
|---|---|---|---|
children | Any decorative figure. | Snippet | standard 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.
| Slot | Purpose |
|---|---|
root | Decorative frame inside the native host. |
header | Avatar area. |
section | Text area. |
avatar | Avatar figure. |
title | Heading. |
paragraph | List of strings. |
| Slot | Purpose |
|---|---|
root | Outer wrapper of an independent element. |
content | Decorative figure. |
Registration tokens
There are six current tokens available in ConfigProvider.theme.components.Skeleton. gradientFromColor and gradientToColor set the colors of the gradient.
| Token | Purpose |
|---|---|
gradientFromColor | Starting color of the gradient. |
gradientToColor | The final color of the gradient. |
titleHeight | Header height. |
blockRadius | Radius of figures. |
paragraphMarginTop | Paragraph indent. |
paragraphLiHeight | Row height. |
| Token | Meaning |
|---|---|
controlHeight | 32 |
controlHeightSM | 24 |
controlHeightLG | 40 |
controlHeightXS | 16 |
borderRadiusSM | 4 |
padding | 16 |
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.