Line chart
A multi-series line chart with a gliding crosshair, legend toggles, and paths that morph between ranges.
Show a compact trend beside a value.
npx shadcn@latest add @silicon-ui/sparklinenpx shadcn@latest add @silicon-ui/sparklineInstall the dependencies.
npm install motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/sparkline/sparkline.tsxcomponents/silicon-ui/sparkline/sparkline.module.cssInstall the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation
| Prop | Type | Default |
|---|---|---|
data* | number[] | — |
label* | string | — |
value | string | — |
change | string | — |
tone | "accent" | "success" | "warning" | "danger" | "accent" |
width | number | 160 |
height | number | 52 |
labelsOne label per point, such as a date. It replaces the change while that point is scrubbed. | string[] | — |
formatValueFormats a scrubbed point for the headline. Defaults to a grouped number. | (value: number, index: number) => string | — |
areaA quiet neutral fill under the line. | boolean | true |
interactivePointer and keyboard scrubbing through the points. | boolean | true |