Bar Chart
ProBars that grow in with a stagger and show values on hover or focus.
Installation
pnpm dlx shadcn@latest add @viewport/bar-chart
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| data* | Datum[] | — |
| title* | stringAccessible title for the chart. | — |
| format | (value: number) => stringFormats values for the tooltip and the data table. | (v) => v.toLocaleString("en-US") |
| height | numberChart height in pixels. | 200 |
| className | string | — |
Accessibility
- The same data is provided as a visually hidden table.
- Each bar is focusable and shows its value.
- Bars appear at full height under reduced motion.