Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Benchmark Bars

ProNew

One 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

PropTypeDefault
title*string

The benchmark's name.

—
metricstring

What is measured, shown as a chip beside the title, e.g. "Score".

—
axisLabelstring

The unit of the value axis, shown as a chip above it, e.g. "Score (%)".

—
items*BenchmarkBar[]—
maxnumber

The 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) => string

Formats a value for its label.

(value) => value.toFixed(1)
heightnumber

The height of the plot, in pixels.

220
classNamestring—

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.