Skip to content
nexubDesign System
v12.7.0

Patterns · Data

StatCard

Since v0.0.1

Metric display card showing a KPI value, label, optional delta, and icon.

import { StatCard } from '@nexub/patterns';
View as Markdown

Examples

Default

Total Revenue
$48,295
+12.5%vs last month

With icon

Users
2,841
+8.3%
Churn
3.2%
-0.4%

Animated

Orders today
1,284

Category and trend

Saved
S$2,400
12%

Compact, absolute change and bad-when-high

Revenue
S$84,320
+12.5%vs last month
Cloud costs
S$12,400
+8.0%vs last month
Includes a one-off migration
Open tickets
42
−12since Monday

Props

Props
PropTypeDefaultDescription
labelrequiredstring—Metric name label.
valuerequiredReact.ReactNode—Primary metric value.
deltastring—Change value (e.g. "+12.5%").
deltaType'neutral' | 'increase' | 'decrease'—Semantic direction of the delta.
sentiment'neutral' | 'positive' | 'negative'derived from `deltaType` (increase → positive, decrease → negative)Colour of the delta, independent of the arrow. Defaults from deltaType; use it when a decrease is good news (e.g. churn down).
iconReact.ReactNode—Icon displayed in the card header.
category'accent' | 'blue' | 'amber' | 'emerald' | 'pink' | 'violet' | 'cyan' | 'red' | 'lime'—Puts the icon on a tinted chip of this colour and colours the trend line to match.
trendnumber[]—Recent values, drawn as a small trend line beside the delta.
trendLabelstring—Accessible summary of the trend. Without it the line is decorative.
descriptionstring—Additional context below the value.
animatebooleanfalseRoll the digits when a number or string value changes (NumberTicker), announced politely. The first render never animates.
size'sm' | 'md''md'Since 11.3. sm is the compact tile: less padding and a smaller value.
noteReact.ReactNode—Since 11.3. An extra line inside the tile, under the change.
tone'default' | 'bad-when-high''default'Since 11.3. bad-when-high inverts the derived colour, so an increase shows the danger tone (costs, churn, errors). sentiment still wins.
changenumber—Since 11.3. The change as a number: sets the arrow from its sign and the text from changeFormat. Ignored when delta is set.
changeFormat'percent' | 'absolute' | ((change: number) => string)'percent'Since 11.3. percent takes a fraction (0.125 → +12.5%); absolute signs the number (−12).
changeLabelReact.ReactNode—Since 11.3. Text after the change, e.g. "vs last month".
loadingbooleanfalse10.5: skeletons in place of the value and the line under it; the card keeps its size.