Skeleton
Grey shapes that hold the place of content while it loads.
import { Skeleton } from '@halo-ds/react';
When to use it
Use skeletons when a page or section takes a moment to load, so people see the layout straight away and nothing jumps when the content arrives. Skeleton is one shape: a text line, a circle or a rectangle. Skeleton pattern combines them into common layouts like a list item, a card or a table row.
Do
- Match the real layout, so nothing jumps when content arrives.
- Show about as many rows or cards as will load.
- Swap all skeletons for content at once, not one by one.
- Keep real headers and labels, and only skeleton the data.
Don't
- Show skeletons for very short waits; they flash.
- Use them for errors or empty results; use an Empty state.
- Leave them on forever; show an error after a timeout.
- Make the shapes darker than real text; keep them soft.
Skeleton or Spinner?
Both show loading. Pick by whether you know the layout.
- Skeleton: Loading a page, a list, a table or a card. You know the shape of what is coming. Waits longer than about 300 milliseconds.
- Spinner: A short action, like saving or sending. Inside a Button, or where the layout is unknown. A whole page that can't show its layout yet.
Props
Skeleton props
| Prop | Type | What it does | |||
|---|---|---|---|---|---|
shape | `"circle" \ | "text" \ | "rectangle" \ | undefined` | text: a 12px line. circle: avatars and icons. rectangle: images and charts. Figma: Shape. |
width | `Width<string \ | number> \ | undefined` | Any CSS width, like 120 or "60%". | |
height | `Height<string \ | number> \ | undefined` | Any CSS height. | |
animation | `"shimmer" \ | "none" \ | undefined` | Shimmer, or none. Reduced motion always turns it off. |
It also takes the usual HTML attributes for its element.
Examples
Overview
import { Skeleton } from '@halo-ds/react';
export default function Example() {
return (
<div style={{ display: 'flex', gap: 16, alignItems: 'center', width: 360 }}>
<Skeleton shape="circle" width={48} height={48} />
<div style={{ display: 'grid', gap: 8, flex: 1 }}>
<Skeleton width="60%" />
<Skeleton width="90%" />
</div>
</div>
);
}
Card
An image, a title and two lines of text.
import { Skeleton } from '@halo-ds/react';
export default function Demo() {
return (
<div className="demo-panel" style={{ display: 'grid', gap: 12, width: 260 }}>
<Skeleton shape="rectangle" height={140} />
<Skeleton width={170} height={16} />
<Skeleton />
<Skeleton width={100} />
</div>
);
}
Stat tile
A label, a big number and a change, for dashboards.
import { Skeleton } from '@halo-ds/react';
export default function Demo() {
return (
<div className="demo-panel" style={{ display: 'grid', gap: 10, width: 220 }}>
<Skeleton width={100} />
<Skeleton width={120} height={28} />
<Skeleton width={80} />
</div>
);
}
More: https://halodesignsystem.dev/components/skeleton