Clinia UI

Skeleton

Holds the shape of content while it loads, so the layout doesn't jump.

shadcn docs →

When to use

  • Content is loading into a layout you already know: a list, a card, a profile.
  • The wait is short, and the page should not jump when the content arrives.

When not to use

  • An action in progress, such as saving: use Spinner in the button.
  • A task with a known length, such as an upload: use Progress.
  • There is nothing to load: use Empty.

Install

npx shadcn@latest add @clinia/skeleton

Clinia rules

  • The block is bg-foreground/8 with rounded-lg. Match its size and radius to the content it stands in for.
  • The pulse stops under prefers-reduced-motion, like every other animation.

Do and don't

Do match the shape of the content that will load.
Don't show one block that doesn't match the layout.

Accessibility

Your responsibility

  • Skeletons are empty div elements and say nothing. Set aria-busy="true" on the loading region, and add sr-only text such as Loading sources.
  • When the content arrives, remove the skeletons, the text and aria-busy together.

How to test

  1. Turn on reduced motion in the OS: the pulse stops.
  2. With a screen reader, the loading text is read, and the skeletons stay silent.
  3. Throttle the network: when the content loads, the layout doesn't shift.

API

Every prop comes from the native div element.