Ballmac UI home

Dumbbell Chart

New

Before and after for many things at once: two dots on one scale with a line between, colored by whether the change is good. Every row also says it in words, such as up 8, better.

v1.0.0Updated Oct 25, 2026Ships with a test
What changed
Answers rated helpful, by topic
  • Refund questions

    71% → 86%up 15%, better

  • Order status

    92% → 94%up 2%, better

  • Account access

    88% → 81%down 7%, worse

  • Billing disputes

    54% → 69%up 15%, better

  • Product advice

    63% → 63%no change

Installation

$ pnpm dlx shadcn@latest add @ballmac/dumbbell-chart

Usage

import { DumbbellChart } from "@/components/ballmac/dumbbell-chart"

The full example is in the Code tab above.

Examples

Response time, lower is better

Response time
  • Search

    420 ms → 310 msdown 110 ms, better

  • Checkout

    280 ms → 340 msup 60 ms, worse

  • Login

    190 ms → 185 msdown 5 ms, better

API reference

PropTypeDefault
rows*DumbbellRow[]—
beforeLabel

What the first dot is, for example "Last version".

string—
afterLabel

What the second dot is, for example "This version".

string—
lowerIsBetter

True when a smaller number is better, for example latency or cost.

booleanfalse
format(value: number) => string(v) => nf.format(v)
titlestring—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
RowsEach row's change is text with better or worse
ChartThe dots and line are decoration
LegendNamed dots above the rows

Use with AI

rows is [{ id, label, before, after }]. beforeLabel and afterLabel name the dots; lowerIsBetter flips which direction is good; format(value); title. Each row writes 'before → after' and 'up N, better' or 'down N, worse' or 'no change'; the line color only repeats it. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Dumbbell Chart (@ballmac/dumbbell-chart) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Comparing two versions, periods or models across several measures
  • Benchmarks and A/B results

Not for

  • Change over many points in time; use chart-line
  • One number against a target; use bullet-chart

Registry JSON: https://ui.ballmac.com/r/dumbbell-chart.json

Credits

Free to use in personal and commercial projects.

npm
None

Ballmac UI Pro

Need the whole screen, not one piece?

150 premium blocks (dashboards, settings, calendars, mail, shops, onboarding), a private shadcn registry and Figma tokens. Blocks that show data come with loading, empty and error states built in.

Not ready? Try three Pro blocks free

Leave your email and the blocks appear right here, ready to copy. Yours to use in any project.