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

Paired Bars

ProNew

Categories 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

PropTypeDefault
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.

—
captionReact.ReactNode

A line under the chart.

—
format(value: number) => string(value) => new Intl.NumberFormat().format(value)
classNamestring—

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.