Skeleton
Use to show a placeholder while content is loading.
Skeleton is a pulsing gray placeholder for content that is still loading. Use shapes that match the geometry of the real content (round avatar, h-4 title, h-3 line of text).
Compared with Spinner: Skeleton is a placeholder for the final layout, Spinner only says "something is loading somewhere".
Installation
$ bext ui add skeleton
Copy and paste the following into src/components/ui/skeleton.tsx.
Usage
Anatomy
<Skeleton className="h-4 w-full rounded-md" />
API Reference
Skeleton
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | Default: rounded-md bg-muted animate-pulse. Add h-N w-N to size it. |
Accessibility
Wrap the container that holds the skeletons with aria-busy="true" aria-live="polite" to tell assistive technologies that the content is loading.
Edit this example live in the bext playground. It compiles and runs entirely in your browser.
The React idiom: same UI, for comparison.
On This Page