Skip to content
Thrum

Bullet chart

Actual against target for a few measures at once: a bar for the value, a tick for the target, and shaded ranges that say whether the value is poor, fair or good. It replaces a row of gauges in a fraction of the room. For one reading on a fixed scale, use the gauge.

Install

npx shadcn@latest add @thrum-pro/bullet-chart

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Data shape

Type
type BulletChartMeasure = {
  name: string;
  value: number | null;      // the bar
  target?: number | null;    // the tick
  ranges: number[];          // 2 or 3 upper ends, low to high
  format?: Intl.NumberFormatOptions;
};
Sample
[
  { name: "Revenue", value: 268000, target: 250000, ranges: [150000, 225000, 300000] },
  { name: "Profit", value: 22.5, target: 26, ranges: [20, 25, 30],
    format: { style: "percent" } },
]

Props

PropTypeDefaultDescription
measuresreadonly BulletChartMeasure[]RequiredOne row per measure, top to bottom. Each row has its own scale from zero (or its lowest value) to the end of its last range, widened to a round number when the value or the target goes past it.
labelstringRequiredWhat the chart shows as a whole. Read by screen readers and used as the table caption.
rangeNamesreadonly string[]Default ["Poor", "Fair", "Good"]Names of the qualitative ranges, lowest first, read in the readout and the table. With two ranges the default is Poor and Good.
colorstringDefault var(--foreground)Any CSS colour for the bar and the target tick. The default keeps 3:1 against every range tint in both themes.
formatIntl.NumberFormatOptionsDefault compactHow values are written on the axis, in the readout and in the data table. A measure's own format wins.
localestringDefault "en-US"Locale for number formatting. Fixed by default so the server and the browser print the same text.
axisbooleanDefault trueShow a scale with value labels under each row, two to six labels depending on the width.
onActiveChange(index: number | null) => void–Called with the index of the row under the cursor, or null when the cursor leaves.
soundbooleanDefault truePlay a tick as the cursor moves between rows, if the visitor has sound on.
emptyLabelstringDefault "No data"Text shown when there are no measures.
classNamestring–Sets the width; the default is full width. The height follows the rows: 52 pixels each with the axis, 34 without, less 10 for the last.

Motion and sound

Motion

  • First draw: each bar grows from zero in 250 ms, rows starting 40 ms apart.
  • New data: bars and target ticks move to their new values in 400 ms with no overshoot.
  • The band behind the active row follows the pointer on a stiff spring.
  • Reduced motion: the chart appears complete, and changes and the cursor move instantly.

Sound

  • A soft tick each time the cursor lands on a different row, at most one every 40 ms.

Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works

Accessibility

  • The chart is one tab stop. It is exposed as a slider whose value text is the row under the cursor, for example “Revenue: $268K, target $250K, Good”.
  • A visually hidden table carries every measure with its actual value, target and range.
  • The ranges are tints of one neutral, told apart by lightness, and the range is named in words in the readout and the table. The bar and the tick differ by shape, and a 2 pixel ring of background keeps the tick apart from the bar.
  • Names longer than the label column (at most 40% of the width) end in an ellipsis; the readout and the table carry them in full.
  • Each whole row, label included, is the pointer target.
KeysAction
TabFocus the chart. The cursor goes to the last row.
↓ ↑Move the cursor one row down or up.
→ ←Also move one row down or up.
Home / EndJump to the first or last row.
EscHide the cursor.

Source

SourcePro

The source comes with Pro

TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies

Files and dependencies

Adds
components/ui/bullet-chart.tsx
Packages
motion
Brings along
Chart foundationsMotion tokensSound engine

Changelog

  1. 1.0.0 · 2026-12-03First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor