Use cases
- Quick-stats row at the top of a dashboard — "Active Roles", "Total Users", "Modules".
- Single metric callouts inside a card-driven layout.
When NOT to use
- For a chart → embed your charting library inside a Card.
- For a small tag on a row → use StatusBadge.
Tones
| Tone | Use when |
|---|---|
primary | Brand metric — counts of system entities. |
accent | Growth / activity — total users, messages. |
success | Positive metric — completion rate, uptime. |
warning | Attention — pending approvals, low-stock. |
danger | Critical metric — failed jobs, breaches. |
neutral | Catch-all when no tonal meaning applies. |
Composition
- The icon slot accepts any 18 px SVG — Lucide icons, hand-rolled SVGs, image assets all work.
valueacceptsReactNode, so you can render a count + an inline trend arrow if needed.- Use a
grid grid-cols-1 sm:grid-cols-3 gap-3wrapper for the canonical 3-up row from the MiHCM Security prototype.
Density
The card is intentionally compact (py-4 px-3). For higher-density dashboards, wrap multiple StatCards in a single Card and use a Separator between them.
Related
- Card — general-purpose container for richer content.
- Chart — data visualization for trends and comparisons.
- StatusBadge — inline status indicator for table rows.