components / sparkline

sparkline.

tiny inline svg trend line — 80x24 by default so it sits in a line of text. linear or catmull-rom smooth, optional area fill and square point markers, no chart library and no dependencies.

machine learning
cybersecurity
working out
installation
bunx @justin06lee/chrome@latest add sparkline
props
nametypedefaultdescription
values *number[]-the series, oldest first. one value renders a flat line.
widthnumber80intrinsic width in px (viewBox units; the svg still stretches to its css box).
heightnumber24intrinsic height in px.
strokestring'currentColor'line color; inherits the surrounding text by default.
strokeWidthnumber1.5line thickness in px, kept 1:1 under stretching.
fillstring-area fill under the line. omit for a bare line.
showDotsbooleanfalsemark every point with a small square.
highlightLastbooleanfalsemark only the last point. ignored when showDots is set.
minnumber-scale floor; defaults to the series minimum.
maxnumber-scale ceiling; defaults to the series maximum.
curve"linear" | "smooth"'linear'polyline, or a catmull-rom curve that still passes through every sample.
labelstring-accessible name; a value-range summary is generated when omitted.
classNamestring-