Line Chart
ProNewSmooth lines that draw in from the left, with a snapping crosshair and a tooltip for every series.
Installation
pnpm dlx shadcn@latest add @viewport/line-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 |
|---|---|---|
| title* | stringAccessible title for the chart. | — |
| labels* | string[]X-axis labels, one per data point. | — |
| series* | Series[] | — |
| format | (value: number) => stringFormats values for the axis, the tooltip and the data table. | (v) => v.toLocaleString("en-US") |
| height | numberChart height in pixels. | 240 |
| area | booleanShade the area under each line. | true |
| className | string | — |
Accessibility
- The same data is provided as a visually hidden table.
- Arrow keys, Home and End move the crosshair; values are announced.
- Appears fully drawn under reduced motion.