Charts
Sparkline
A tiny trend beside a value.
Usage
Sparkline is a tiny trend with no axes or tooltip, made for KPI tiles and table rows. It fills its parent's width. Pass trend to colour it by direction and give it an aria-label that states the point of the trend.
New signups
84+121% in 12 days
Weekly signups
612last 12 weeks
Churn rate
2.7%down from 4.1%
When to use
- Next to a number, to show where it is heading.
- In dense tables, one per row.
Not for: reading exact values (use a line chart with a tooltip).
API
Sparkline
| Prop | Type | Default | Description |
|---|---|---|---|
| data | (number | Record<string, unknown>)[] | — | Numbers, or records read through valueKey. |
| valueKey | string | 'value' | Key to read from record data. |
| variant | 'line' | 'area' | 'bar' | 'line' | Bars emphasise the last value. |
| width / height | number | fill · 32 | Width fills the parent unless set. |
| color | SeriesColor | series-1 | Theme series or any CSS colour. |
| trend | boolean | false | Success colour when the last value is above the first, destructive when below. Not for metrics where down is good. |
| dot | boolean | true | Dot on the last point (line and area). |
| curve / strokeWidth | 'monotone' | 'linear' | 'step' · number | 'monotone' · 1.5 | Line shape and weight. |
| aria-label | string | — | Defaults to "Trend, N points, from X to Y". |
Accessibility
- role="img" with a label. It is decorative detail, so the number beside it must carry the information.
Motion
- The line draws in (600ms) or the bars grow; nothing animates during server render. Reduced motion skips it.