Stat Card
A KPI tile: a metric label, a big preformatted value, and an optional signed delta. The sign of delta gives direction; goodWhen decides whether that direction reads as success or danger. The piece never formats numbers — pass value as a finished string.
Revenue
$48,120
up 12.4 percentvs last month
Active users
8,540
up 3.2 percentvs last week
Churn rate
2.1%
up 0.4 percentvs last month
Avg order value
$86.40
down 1.8 percentvs last month
Installation
Copy the piece, its Sparkline dependency, and the shared math helper into your app:
puzzle add piece stat-card
StatCard composes Sparkline for its optional trend, so both pieces plus lib/chart-math.js come along.
Usage
import StatCard from '@/components/ui/StatCard.pzl';
<StatCard label="Revenue" value="$48,120" delta={ 12.4 } deltaLabel="vs last month" />Inverted sentiment
Churn rate
2.1%
up 0.4 percentvs last month
Support cost
$12,900
down 6.5 percentvs last quarter
With sparklines
Revenue
$48,120
up 12.4 percentvs last month
Avg order value
$86.40
down 1.8 percentvs last month
Without a delta
Total sessions
18.3k
Countries
42
Uptime
99.98%