Skeleton
Feedback
Loading
Display placeholder content while data is loading.
Preview
Card loading state example
Variants
Different skeleton shapes
Text (default)
Circle
Rectangle
Common Patterns
Skeleton layouts for typical UI elements
User Card
Article
Form Field
Stat Card
Props
Skeleton component API reference
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'text' | 'circle' | 'rectangle' | 'text' | Shape variant |
width | string | number | — | Width (px or %) |
height | string | number | — | Height (px or em) |
className | string | — | Additional CSS classes |
Usage
Import and implementation examples
import { Skeleton } from '@/components/ui/skeleton'
// Text placeholder
<Skeleton width="60%" height="1em" />
// Circle (avatar placeholder)
<Skeleton variant="circle" width={48} height={48} />
// Rectangle (image placeholder)
<Skeleton variant="rectangle" width="100%" height={200} />
// Card loading state
<div className="flex items-start gap-4">
<Skeleton variant="circle" width={48} height={48} />
<div className="flex-1 space-y-2">
<Skeleton width="40%" height="1.2em" />
<Skeleton width="100%" height="1em" />
<Skeleton width="80%" height="1em" />
</div>
</div>Features
Built-in functionality
- 3 variants: Text, circle, and rectangle shapes
- Flexible sizing: Width and height support px, em, and % units
- Pulse animation: Built-in loading animation
- Composable: Combine multiple skeletons for complex layouts
- Dark mode: Adjusted colors for dark mode
Accessibility
Accessibility considerations
ARIA Attributes
Uses aria-hidden="true" since content is decorativeLoading state should be communicated separatelyKeyboard Navigation
| Key | Action |
|---|---|
| N/A | Skeleton is not interactive |
Notes
- Use aria-busy on parent container when loading
- Announce loading state with aria-live region
- Respect prefers-reduced-motion for animations