Skeleton
Placeholder blocks drawn in the final layout, which stand in for content with a known layout while it takes more than a second to load.
When to use
- A list, table, card grid, or set of profile fields whose layout is known and whose content takes more than a second to arrive (canonical §10.23, D-CSN-29).
- The first load of a section: "Loading people…" for a directory, "Loading appointments…" for a schedule.
When not to use
| Situation | Use instead |
|---|---|
| The wait is under a second | Keep the old content and set [aria-busy="true"] on the region |
| An action of one to ten seconds (saving, sending) | A spinner with words, in the button or the region |
| The layout is not known in advance | A 48px spinner with words in the region |
| Work whose amount is known (an import) | The determinate progress bar |
| Something that is not built or not there | A dashed placeholder card with "Coming soon", or an empty state |
Anatomy
- Busy region: the container the content will fill, with
[aria-busy="true"]. - Hidden line: one visually hidden "Loading {thing}…" (
.oa-visually-hidden), the only thing a screen reader hears. - Blocks:
.oa-skeletonelements with a shape modifier, placed inside the final layout's own components (list rows, cards, table cells), hidden from screen readers as a group.
Variants
| Variant | Use for | Key tokens |
|---|---|---|
Line (.oa-skeleton--line) |
A line of body text: 16px tall; shorten the last lines of a paragraph to 80% and 60% | --color-skeleton, --radius-4px |
Title (.oa-skeleton--title) |
A title or headline: 24px tall | --color-skeleton, --radius-4px |
Block (.oa-skeleton--block) |
A photo, a card, a chart: the size or aspect ratio of what it stands for | --color-skeleton, --radius-card unless the final element has other corners |
Circle (.oa-skeleton--circle) |
An avatar or a disc: 40px (avatar-sm) unless the final avatar is larger |
--color-skeleton, --radius-full |
Sizes
| Size | Height | Padding | Type style | Icon size |
|---|---|---|---|---|
| Line | 16px (a component constant); widths 100%, 80%, 60% | — | stands for body-lg or body-md |
— |
| Title | 24px | — | stands for titles and headlines | — |
| Block | the media's own size or aspect ratio (aspect-ratio: 4 / 5 for a portrait) |
— | — | — |
| Circle | --size-avatar-sm (40px), or the final avatar's size |
— | — | — |
Lines in a paragraph sit 8px apart (.oa-stack--tight), so each 16px line and its gap take the 24px of a line of body-lg.
Tokens
| Part | Property | Token |
|---|---|---|
| Block | fill | --color-skeleton (= surface-container-highest: #eae0da light, #3d332d dark) |
| Block | sweep | linear-gradient(90deg, var(--color-skeleton), var(--color-skeleton-highlight), var(--color-skeleton)) at a background size of 220% 100%; --color-skeleton-highlight = surface-container-high |
| Block | motion | --animate-skeleton (oa-skeleton over --duration-loop-skeleton, 1200ms, linear, infinite) |
| Line, title | corners | --radius-4px (rounded-4px) |
| Block, circle | corners | --radius-card, --radius-full |
| Block | edge | 1px solid transparent, drawn only in forced colors |
The two skeleton roles alias neutral roles, so they follow the theme and never carry the product accent (D-ARC-10).
States
| State | What changes |
|---|---|
| Loading | The highlight sweeps across each block once every 1200ms, from the start of the gradient to its end. |
| Reduced motion | No sweep and no gradient: a flat --color-skeleton fill (tokens: "their flat fill under reduced motion"). |
| Paused | Inside a [data-motion="paused"] region the sweep stops where it is. |
| Loaded | The blocks and the hidden line leave; the content takes their place; the region drops [aria-busy="true"]. |
| Hover, focus, pressed, disabled | None: blocks are not interactive and hold nothing focusable. |
Behavior
- When to show. Keep the region empty or keep the old content for the first second; show blocks when the content has not arrived after a second (canonical §10.23).
- In the final layout. Build the blocks with the same components the content will use: a list row with a circle and two lines, a card with a title line, three text lines, and a media block. Show about as many as the first screen will hold (five rows for a member list, canonical §10.12), so nothing jumps when the content arrives.
- Done. Replace the blocks in place and remove
[aria-busy="true"]. Focus does not move. If loading fails, put an error banner or the right empty or error state in the region. - Motion. The sweep runs only while motion is allowed and only while loading; it never runs once content is in place (canonical §7.4).
Accessibility
- Region.
[aria-busy="true"]on the container and one visually hidden "Loading {thing}…": a screen reader hears one line, not a row of empty boxes (D-CSN-29). - Blocks. Hidden from screen readers as a group (
<ul aria-hidden="true">,<div aria-hidden="true">); they hold no text and nothing focusable. - Contrast. Decorative:
skeletonis 1.30:1 on white, which is why the words carry the meaning. - Reduced motion. A flat fill, no sweep.
- Forced colors. The transparent 1px edges outline each block.
RTL and languages
- Shortened lines keep to the inline start, so in Arabic they hang from the right; blocks mirror with the layout that holds them.
- Translate the hidden line with the page: "Loading appointments…" / "جارٍ تحميل المواعيد…".
Content
- One hidden line that names the thing: "Loading people…", "Loading appointments…", "Loading your event…".
- The verb in -ing and the single ellipsis character, never three full stops and never "Please wait" (canonical §12.4, TK-2.20).
| English | Arabic |
|---|---|
| Loading your event… | جارٍ تحميل الحدث… |
| Loading appointments… | جارٍ تحميل المواعيد… |
Both ship in Global Games. French follows the same pattern and needs native review.
Do and don't
| Do | Don't |
|---|---|
| Draw list rows with a circle and two lines where the list will be | Cover the region with one large gray rectangle or a big spinner |
| Hide the blocks and say "Loading people…" once | Let a screen reader find a dozen empty elements, or say nothing |
| Keep a flat fill under reduced motion | Keep a frozen gradient band, or Tailwind's pulse animation |
| Shorten the last lines to 80% and 60% | Draw every line at full width |
| Use a spinner with words for an action | Put a skeleton inside a button |
Code
HTML (reference CSS)
A member list loading:
<div aria-busy="true">
<p class="oa-visually-hidden">Loading people…</p>
<ul class="oa-list oa-list--card" aria-hidden="true">
<li class="oa-list-row oa-list-row--two-line">
<span class="oa-list-row__leading"><span class="oa-skeleton oa-skeleton--circle"></span></span>
<span class="oa-list-row__content oa-stack oa-stack--tight"><span class="oa-skeleton oa-skeleton--line" style="inline-size: 60%"></span><span class="oa-skeleton oa-skeleton--line" style="inline-size: 80%"></span></span>
</li>
<li class="oa-list-row oa-list-row--two-line">
<span class="oa-list-row__leading"><span class="oa-skeleton oa-skeleton--circle"></span></span>
<span class="oa-list-row__content oa-stack oa-stack--tight"><span class="oa-skeleton oa-skeleton--line" style="inline-size: 60%"></span><span class="oa-skeleton oa-skeleton--line" style="inline-size: 80%"></span></span>
</li>
</ul>
</div>A card loading:
<div class="oa-card" aria-busy="true">
<p class="oa-visually-hidden">Loading appointments…</p>
<div class="oa-stack oa-stack--tight" aria-hidden="true">
<span class="oa-skeleton oa-skeleton--title" style="inline-size: 60%"></span>
<span class="oa-skeleton oa-skeleton--line"></span>
<span class="oa-skeleton oa-skeleton--line" style="inline-size: 80%"></span>
<span class="oa-skeleton oa-skeleton--line" style="inline-size: 60%"></span>
<span class="oa-skeleton oa-skeleton--block" style="aspect-ratio: 16 / 5"></span>
</div>
</div>The Arabic example is in reference/snippets/feedback.html.
Tailwind CSS v4
<div aria-busy="true">
<p className="sr-only">Loading people…</p>
<ul aria-hidden="true" className="overflow-hidden rounded-card border border-outline-variant bg-card-outlined-container py-2">
<li className="flex min-h-18 items-center gap-4 px-row-inset py-2 sm:ps-row-inset-medium">
<span className="block size-10 shrink-0 rounded-full border border-transparent bg-skeleton motion-safe:animate-skeleton motion-safe:bg-[linear-gradient(90deg,var(--color-skeleton),var(--color-skeleton-highlight),var(--color-skeleton))] motion-safe:bg-size-[220%_100%]" />
<span className="flex min-w-0 flex-1 flex-col gap-2">
<span className="block h-4 w-3/5 rounded-4px border border-transparent bg-skeleton motion-safe:animate-skeleton motion-safe:bg-[linear-gradient(90deg,var(--color-skeleton),var(--color-skeleton-highlight),var(--color-skeleton))] motion-safe:bg-size-[220%_100%]" />
<span className="block h-4 w-4/5 rounded-4px border border-transparent bg-skeleton motion-safe:animate-skeleton motion-safe:bg-[linear-gradient(90deg,var(--color-skeleton),var(--color-skeleton-highlight),var(--color-skeleton))] motion-safe:bg-size-[220%_100%]" />
</span>
</li>
</ul>
</div>Titles use h-6; media blocks rounded-card with an aspect ratio. shadcn/ui's Skeleton is edited to this recipe instead of its pulse animation (canonical §2.12, V-7):
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="skeleton"
className={cn("rounded-4px border border-transparent bg-skeleton motion-safe:animate-skeleton motion-safe:bg-[linear-gradient(90deg,var(--color-skeleton),var(--color-skeleton-highlight),var(--color-skeleton))] motion-safe:bg-size-[220%_100%]", className)}
{...props}
/>
)
}React
| Prop | Type | Default | Description |
|---|---|---|---|
shape |
"line" | "title" | "block" | "circle" |
"line" |
The block's shape and default size. |
width |
string |
"100%" |
The width of a line or block: "80%", "60%". |
className |
string |
— | Size or aspect ratio for blocks and circles. |
SkeletonRegion takes label (the hidden "Loading {thing}…") and children (the blocks); it renders the busy container, the hidden line, and the hidden group.
<SkeletonRegion label={t("loadingAppointments")}>
<Skeleton shape="title" width="60%" />
<Skeleton />
<Skeleton width="80%" />
</SkeletonRegion>