Design System
Data display

Skeleton

Stand in for content that is still loading, matching the shape it will settle into so the layout does not jump.

Purpose

A skeleton is worth the effort only when it matches the real shape. A grey box of the wrong size causes the layout shift it was meant to prevent.

Example

Shape everything with className: the component brings only the fill, the pulse and a default radius. Round it to rounded-full for avatars, size text lines to the type scale they replace, and vary line widths so the placeholder reads as text rather than a block.

Structure

The tokens behind the placeholder.

PropertyValue
Fill--muted (bg-muted)
Animationanimate-pulse — Tailwind's 2s opacity fade, looping
Radius--radius-md (6px) by default (rounded-md); override per shape
Sizenone of its own — size each skeleton with utilities to match the content

Best practices

Do

  • Match the final content's dimensions exactly — same heights, same gaps, same radius.
  • Show a fixed, plausible count (five table rows, three cards) rather than one giant block.
  • Vary the widths of text-line skeletons so they read as text.
  • Pair the skeleton with an error state — loading is not the only way a fetch ends.

Don't

  • Show a skeleton and a Spinner for the same load — pick one indicator per region.
  • Approximate the layout — a wrong-shaped skeleton causes the jump it exists to prevent.
  • Leave a skeleton up indefinitely; if the data may never arrive, time out into an empty or error state.

Accessibility & keyboard

A skeleton is decorative — it renders an empty <div> with no role and no text, so a screen reader user gets nothing from the placeholder itself. The loading state must be announced on the region, not the skeleton:

  • Set aria-busy="true" on the region being loaded, and remove it when the real content lands.
  • Hide the skeletons themselves from assistive technology with aria-hidden="true" on their container — they are visual filler, not information.
  • If the arrival matters (search results, a refreshed total), make the container an aria-live="polite" region so the replacement content is announced.
  • Keyboard: none — skeletons are non-interactive and never receive focus.
Announcing the load, not the skeleton
<section aria-busy={isLoading} aria-live="polite">
  {isLoading ? (
    <div aria-hidden="true">
      <Skeleton className="h-4 w-3/4" />
      <Skeleton className="mt-2 h-4 w-1/2" />
    </div>
  ) : (
    <ClaimSummary claim={claim} />
  )}
</section>

Props

Skeleton renders a <div> and takes only HTML attributes — className does all the shaping; there are no props of its own.

Card and table-row skeletons in Storybook

On this page