ui-kit0.0

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

PropTypeDefaultDescription
data(number | Record<string, unknown>)[]—Numbers, or records read through valueKey.
valueKeystring'value'Key to read from record data.
variant'line' | 'area' | 'bar''line'Bars emphasise the last value.
width / heightnumberfill · 32Width fills the parent unless set.
colorSeriesColorseries-1Theme series or any CSS colour.
trendbooleanfalseSuccess colour when the last value is above the first, destructive when below. Not for metrics where down is good.
dotbooleantrueDot on the last point (line and area).
curve / strokeWidth'monotone' | 'linear' | 'step' · number'monotone' · 1.5Line shape and weight.
aria-labelstring—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.