Stat Card
One figure on a dashboard: a title, a 32 px navy figure, and either a sparkline of recent values or the change against the last period. Each direction has its own arrow; a good change is green and a bad one red, where better says which way is good.
BetaReady to use. Its API can still change in a minor release; the changelog says when.
import { StatCard } from "@leap-crm/design-system";Playground
Change a prop and the component follows. Its code is under Props.
Pipeline value
Open opportunities
$184,250
Props
title
subtitle
value
rate
Best practices
When to use it, and the rules that apply in particular places.
| Guidance | Practice |
|---|---|
| Do | Set better="down" on a delta where a fall is good news, like days to convert, so a drop shows green and not red. |
| Do | Give a delta a label, like "vs prev period", so the reader knows what the change is measured against. |
| Do | Line stat cards up in a row of equal height. The figure and what's under it sit on the card's bottom edge, so the figures line up whatever the titles. |
| Do | Show either a trend or a delta, so the figure stays the strongest thing on the card. |
| Don't | Move the figure up under its title with a class. In a row of cards with different titles, the figures would sit at different heights. |
| Don't | Use it for a figure the user picks to filter by, like a pipeline stage. Use CardButton with CardLabel and CardValue. |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title * | ReactNode | — | What's counted, like "New opportunities". |
| subtitle | ReactNode | — | A muted line under the title, like "Share of closed opportunities". |
| value * | ReactNode | — | The figure, formatted, like "148" or "31%". Text or a number rolls its digits when it changes. |
| rate | ReactNode | — | A rate beside the figure, like "12 / month". |
| trend | unknown | — | Recent values, oldest first, drawn as a sparkline under the figure. |
| delta | { /** The change, formatted, like "4.2%". */ value: string; /** Whether it went up or down, shown by its own arrow and read out. */ direction: "up" | "down"; /** Which way is good, like "down" for days to convert. A good change is green, a bad one red. */ better?: "up" | "down"; /** What it's compared with, like "vs prev period". */ label?: string; } | — | The change against the previous period, under the figure. |
| className | string | — | Classes added to the root element, merged with its own. Tokens only. |
Code
What the playground shows, ready to copy.
import { StatCard } from "@leap-crm/design-system";
<StatCard
title="Pipeline value"
subtitle="Open opportunities"
value="$184,250"
/>Sparkline and delta
New opportunities
148
12 / month
Converted to matters
Share of closed opportunities
31%
Up 4.2%vs prev period
Average days to convert
23
Down 3 daysvs prev period
What the examples share
The imports and the scaffolding the examples above call. The scaffolding lives in this page, not in the library.
import { StatCard } from "@leap-crm/design-system";
const monthly = [3, 6, 4, 8, 7, 11, 10, 13, 12, 16, 14, 18] as const;




