Bar chart
Compare one measure across days and scrub any bar for its value.
npx shadcn@latest add @silicon-ui/bar-chartInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/bar-chartManually
Install the dependencies
npm install motionCopy these files into your project
- components/silicon-ui/bar-chart/bar-chart.tsx
- components/silicon-ui/bar-chart/bar-chart.module.css
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| 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) |
Dependencies
- npm
- motion
- Registry
- silicon-motion-tokens