Base JS behaviour

Stat card

The dashboard KPI with a number that rolls up from zero, a trend delta, a sparkline and prefix/suffix.

Real scenarios

The component as it is used in a product — not a specimen grid.

Monday morning, one glance

Each number counts itself up when it scrolls in, the sparkline draws its path, and the caption answers “compared to what?”.

Revenue, 30 days +12.4%
482,600,000 Toman

vs the 30 days before

Active stores +3.8%
1,284

137 opened, 86 closed

Churn -0.6%
2.4 ٪

down is the good news

Uptime +0.0%
99.98 ٪

6 minutes down, all planned

A delta can be bad news too

Same component, honest trend: support wait time climbing after the launch week.

Median first reply +18.2%
41 min

two agents on vacation

Bare, without a trend line

Drop trend and delta — the counting number alone still earns its seat in a table header or footer.

Open tickets
214

right now

Important props

Important props
Prop Type Default What it does
value / decimals number 0 / 0 The main figure and its decimals; digits localize to Persian.
delta / invertDelta number|bool null / false Percent change; invert what counts as good for metrics like churn.
prefix / suffix / caption string null Currency unit, suffix and the comparison caption.
trend array null The sparkline series inside the card.

Snippet

<x-nx::stat-card label="درآمد ماه" :value="482600000" suffix=" تومان"
    :delta="12.4" :trend="[12, 18, 14, 22, 19, 26]" caption="نسبت به ماه گذشته" />