Sparkline
Charts

Sparkline

Tiny inline trend line matching the SVG spark polyline inside KPI cards.

Props

SparklineProps props
PropTypeDefaultDescription
valuesnumber[]—Data points for the spark line.
widthnumber72SVG width in pixels.
heightnumber22SVG height in pixels.
colorstring"var(--m-color-primary)"Line stroke color.
strokeWidthnumber1.25Line stroke width.

Sparkline extends SVGAttributes<SVGSVGElement>. Returns null when values is empty.

Examples

Different colors

Sparkline colors

Different widths

Sparkline widths
ImportTSX
import { Sparkline } from "@solarius/onset";

<Sparkline values={[5, 10, 8, 15, 12]} />
<Sparkline values={data} color="var(--m-color-ok)" width={120} strokeWidth={2} />