Paired Bars
ProNewCategories with one horizontal bar per series, filling row by row a beat apart. The legend isolates a series; values sit at the end of each bar.
Installation
pnpm dlx shadcn@latest add @viewport/paired-bars
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* | string | — |
| series* | PairedSeries[]What is being compared, e.g. two versions of a benchmark. Each gets a bar in every row. | — |
| rows* | { label: string; values: number[] }[]One row per category, with a value for each series in order. | — |
| caption | React.ReactNodeA line under the chart. | — |
| format | (value: number) => string | (value) => new Intl.NumberFormat().format(value) |
| className | string | — |
Accessibility
- Every value is text and is read with its series name.
- Legend entries are buttons: hover, focus or press isolates a series.
- Labels move above their bars on narrow containers.
- Everything is shown at once under reduced motion.