Skip to content

Skeleton

Placeholder shapes that mimic content while it loads — text lines, rectangles, and circles with pulse or wave animation.

  • stable
  • since v0.1.0
  • 0.5 kB
  • data-display
  • loading
  • placeholder

Marked aria-hidden so screen readers skip placeholders; pair with an aria-live region to announce when real content arrives.

Preview
Open
tsx

Three shape variants are available: text (default — line height-aware), rect (sharper corners for media tiles), and circle (avatars and icon placeholders).

Preview
Open
tsx

Switch animation between "pulse" (default), "wave", and "none". The wave variant honours prefers-reduced-motion and falls back to a static state.

Preview
Open
tsx

Compose multiple skeletons into a card-shaped placeholder while a fetch is in flight.

Preview
Open
tsx
PropTypeDefaultDescription
variant
"text"|"rect"|"circle"
text
Visual shape: `text` is a short rounded line, `rect` is a flexible rectangle, `circle` paints a perfectly round shape (pair with equal `width` and `height`).
animation
"pulse"|"wave"|"none"
pulse
Loading animation. `pulse` fades opacity in/out, `wave` sweeps a highlight across, `none` disables motion.
width
string|number
Explicit width (number is converted to `px`).
height
string|number
Explicit height (number is converted to `px`).
aspectRatio
string|number
CSS `aspect-ratio` for proportional placeholders (e.g. `"16 / 9"`).
  • aria-hidden="true" by default so the placeholder is not announced.
  • Honours prefers-reduced-motion — falls back to a static state when animations are disabled.
  • Pair with an aria-live="polite" region (or a status message) that announces when real content arrives.
  • Use enough placeholder rows to match the inbound content’s rough shape — sudden layout shifts hurt low-vision users most.
  • Skeletons carry data-variant on the host element so design tokens can theme each shape differently.
  • Use variant="text" for line placeholders that inherit the surrounding type scale; pass a smaller width on the last line for natural ragged-edge text.
  • Use variant="circle" with equal width and height for avatar placeholders.
  • Pass aspectRatio (e.g. "16 / 9") instead of height for responsive media tiles.
  • Set animation="none" inside infinite scrollers — many simultaneous wave animations get distracting fast.