Benchmark Bars
ProNewOne benchmark as labelled bars that rise in sequence. Pointing at a bar gives it its color and quiets the rest; the featured result is in color from the start.
Installation
pnpm dlx shadcn@latest add @viewport/benchmark-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* | stringThe benchmark's name. | — |
| metric | stringWhat is measured, shown as a chip beside the title, e.g. "Score". | — |
| axisLabel | stringThe unit of the value axis, shown as a chip above it, e.g. "Score (%)". | — |
| items* | BenchmarkBar[] | — |
| max | numberThe top of the value axis. Defaults to the next round number above the largest value. | — |
| colorMode | "featured" | "all"`featured` colors only the featured bars and leaves the rest neutral until hovered; `all` colors every bar. | "featured" |
| format | (value: number) => stringFormats a value for its label. | (value) => value.toFixed(1) |
| height | numberThe height of the plot, in pixels. | 220 |
| className | string | — |
Accessibility
- A list of results: each bar is focusable and reads its model and value.
- Focus isolates a bar the same way hover does.
- Labels turn on their side on narrow containers instead of overlapping; text never scales down.
- Bars and values appear at once under reduced motion.