[ Feedback ]
Skeleton
A shimmering placeholder that mimics the shape of content while it loads. It reduces layout shift and makes loading feel faster than a spinner.
2 examplesDark modeAccessible
Import#
import { Skeleton } from 'reusify-ui';When to use#
- Loading cards, lists, profiles and other content whose shape you know in advance.
Examples#
Text, circle, rect#
lines renders multiple text lines; the last one is shorter, like a real paragraph.
<Skeleton variant="circle" width={48} />
<Skeleton lines={3} />
<Skeleton variant="rect" height={120} />Loading → content#
Swap the skeleton for real content once data arrives. This demo toggles every 2 seconds.
{loading ? (
<>
<Skeleton variant="circle" width={48} />
<Skeleton lines={2} />
</>
) : (
<Profile user={user} />
)}API reference#
<Skeleton />
Also accepts every <span> attribute.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'text' | 'rect' | 'circle' | 'text' | Shape of the placeholder. |
width | string | number | - | CSS width. Circles use it for height too. |
height | string | number | - | CSS height. |
lines | number | 1 | Number of text lines (text variant only). |
variant'text''text' | 'rect' | 'circle'Shape of the placeholder.
width-string | numberCSS width. Circles use it for height too.
height-string | numberCSS height.
lines1numberNumber of text lines (text variant only).
Accessibility#
- Skeletons are aria-hidden. Mark the loading region with aria-busy="true" so assistive tech knows content is coming.
- The shimmer stops when the user prefers reduced motion.