Sparkline
A path-drawn micro-chart that draws in on reveal and updates live as values change.
API reference
Components
<Sparkline />
Line and area micro-chart with optional draw-in and live morphing.
history?
Data mode: a window of readings mapped to the curve.
path?
Literal mode: a hand-drawn SVG path d string.
width?
viewBox width. Default 280.
height?
viewBox height. Default 64.
padY?
Vertical inset for history mapping. Default 10.
tone?
Line/area colour tier. Default "primary".
area?
Render the area fill under the line. Default false.
grid?
Faint horizontal gridline y-positions in viewBox coordinates.
dot?
Render the accent endpoint dot. Default false.
dotX?
Endpoint-dot x in literal mode. Defaults to width.
dotY?
Endpoint-dot y in literal mode. Defaults to 0.
dotRadius?
Endpoint-dot radius. Default 3.5.
draw?
Draw the line in once via a pathLength reveal. Default false.
revealed?
Gate for the draw reveal. Default true.
tickKey?
Bump this on every live tick to pulse the endpoint dot.
strokeWidth?
Line stroke width, in viewBox units. Default 2.
nonScalingStroke?
Keep the stroke a constant screen width regardless of transform scaling.
motionAllowed?
Reduced-motion gate. Derived from the theme when omitted.
label?
Accessible label. Exposes role="img" when set.
className?
Merged onto the <svg>.
Functions
buildSparkPath
Maps a numeric history window to sparkline geometry.
buildSparkPath(history: number[], options: SparkPathOptions = {}): SparkGeometryReturns
d
The M ... L ... line path across every reading.
areaD
d closed down to the baseline and back.
points
Every reading mapped to a viewBox point.
first?
The first (left-most) point.
last?
The last (right-most) point.
buildSparkAnimation
Motion targets for a data-driven state change.
buildSparkAnimation(geometry: SparkGeometry): voidd
The M ... L ... line path across every reading.
areaD
d closed down to the baseline and back.
points
Every reading mapped to a viewBox point.
first?
The first (left-most) point.
last?
The last (right-most) point.
Featured in
See the sparkline composed into full sections.
