Components
Sparkline
Trend line without axes for cards and table rows, with an optional area fill, accent tail and dashed last segment.
import { Sparkline } from "@openperf/deft";
<Sparkline.Root values={[2, 4, 3, 6, 5, 8, 12]} />;When to use
| Need | Component |
|---|---|
| Shape of one series next to its number, in a card or a row | Sparkline |
| Exact values, time labels, a tooltip or several series | Chart |
| Single proportion, breakdown or percentile spread | Meter |
Sparkline is hidden from assistive technology: always show the value as text next to it, for example in a Stat or a Metric.
Scale
The line is scaled from 0 to the largest value, or to 1 when every value is below 1, so series with different ranges are not comparable by height. A null entry is skipped and the line joins the points around it.
Sizes
| Size | Width | Height |
|---|---|---|
sm | 64px | 16px |
fill | Container width | 28px |
cover | Parent width | Parent height |
The drawing stretches to its box without keeping the aspect ratio; the line stays 1.5px thick. tail repaints the trailing fraction (0–1) of the line in the accent color.
Area
area fills the space under the line at 12% opacity. Combine it with size="cover" for the backdrop of a Metric card.
API
Prop
Type