Line chart
A multi-series line chart with a gliding crosshair, legend toggles, and paths that morph between ranges.
Compare one measure across days and scrub any bar for its value.
npx shadcn@latest add @silicon-ui/bar-chartnpx shadcn@latest add @silicon-ui/bar-chartInstall the dependencies.
npm install motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/bar-chart/bar-chart.tsxcomponents/silicon-ui/bar-chart/bar-chart.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* | BarChartDatum[] | — |
label*What is measured, such as "Active minutes". Names the chart for assistive technology. | string | — |
period*The range on show, such as "Sep 15–21, 2026". It rests under the headline. | string | — |
unitUnit after each value, such as "min". | string | "" |
averageLabelHeadline label at rest, above the average. | string | "Daily average" |
valueLabelHeadline label while a bar is scrubbed. | string | "Total" |
categoryLabelHeader of the first column in the data table read by screen readers. | string | "Day" |
showAverageDraws the average as a reference line that springs to each new range. | boolean | true |
heightPlot height in pixels. | number | 176 |
formatValue | (value: number) => string | value => grouped.format(value) |