Skip to content

Bullet Chart for React

A React bullet chart shows actual against target with qualitative ranges behind, so many KPIs fit where one gauge would. Pass data as readonly BulletItem[]: the rows to draw, one per measure.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/bullet-chart.json

Q3 performance

Use up and down arrow keys to read each row.

  • BulletChart
  • BulletTable
  • bulletLegend
  • defaultBulletChartLabels
  • +2 more

KPI dashboard

Each row has its own scale (different units), ticked underneath. Rows can bring their own format. On phones the names move above each bullet.

Q3 performance

Actual against target, with poor / fair / good ranges

  • Actual
  • Target
  • Poor
  • Fair
  • Good

Files to copy

11 folders · 26 files · 4 packages
From theme/src/
  • components/charts/{bullet-chart.tsx, chart-export-menu.tsx, chart-export.ts, chart-figure.tsx, chart-fit.tsx, chart-icons.tsx, chart-parts.tsx, chart-patterns.tsx, chart-utils.ts, range-area-chart.tsx}
  • components/charts/chart-parts/
  • components/drawer/parts/sheet.tsx
  • components/kbd/
  • components/menu/
  • components/skeleton/
  • components/status-icons/
  • hooks/{use-controllable.ts, use-intersection.ts, use-latest.ts, use-media-query.ts, use-preferences.ts}
  • motion/tokens.ts
  • lib/{cn.ts, csv.ts, form.ts, glide-highlight.tsx, heading.ts, math.ts, popup-a11y.ts, popup-motion.ts, warn-once.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/bullet-chart.jsonRegistry item: bullet-chart. The styles need the Tailwind v4 glass UI setup.
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Next.js: samples here pass functions (formatters, seriesLegend, a dashboard's load), so put them in a file that starts with "use client".

Shared scale, lower is better

scale="shared" puts every row on one axis, so lengths compare across rows. With higherIsBetter: false, beating the target means coming in under it; the range names come from labels.

API latency

Last 24 hours, against SLO targets

  • Actual
  • Target
  • Fast
  • Acceptable
  • Slow

Props

PropTypeDefaultDescription
data (required)readonly BulletItem[]NoneThe rows to draw, one per measure.
scale"row" | "shared""row""row": each row gets its own scale, ticked underneath (measures in different units). "shared": one scale for every row, ticked once at the bottom (same unit, comparable lengths).
ticksbooleantruePrints scale ticks along each bar.
showDeltabooleantrueShow the delta against the target under each value.
format((n: number) => string)formatCompactFormats values (rows can override with their own format).
emptyStateReactNodeNoneShown when there is nothing to plot.
labelsPartial<BulletChartLabels>defaultBulletChartLabelsEvery other string, for translation: labels={{ instructions: "…" }}; omitted keys keep the English of defaultBulletChartLabels. All 12 keys of BulletChartLabels are listed in the key table under the props table.
aria-label (required)stringNoneAccessible summary of what the chart shows.
classNamestringNoneAdds extra classes to the outer element.
BulletChartLabels keys and English defaults (12)
Pass any key in labels; the rest keep the defaults of defaultBulletChartLabels.
KeyEnglish default
instructionsUse up and down arrow keys to read each row.
actualActual
targetTarget
ranges["Poor", "Fair", "Good", "Excellent", "Outstanding"]
vsTarget(delta) => `${delta} vs target`
onTargetOn target
between(low: string, high: string) => /^[-−]/.test(low) || /^[-−]/.test(high) ? `${low} – ${high}` : `${low}–${high}`
measureMeasure
rangeRange
deltavs target
missing–
emptyNo data

BulletItem

PropTypeDefaultDescription
label / descriptionstringNoneName, and an optional unit or context line under it.
valuenumberNoneRequired. The measure, drawn as the bar.
targetnumberNoneSets the comparative measure, drawn as the marker.
rangesnumber[]NoneUpper bounds of the qualitative ranges, lowest first. The last stretches to the end of the scale.
rangeLabelsstring[]labels.rangesNames of this row's ranges, lowest first.
min / maxnumber0 / nice maxEnds of the row's scale.
higherIsBetterbooleantrueWhether beating the target is good (revenue) or bad (costs, latency).
color1–81Sets the palette slot of the bar.
format(n) => stringNoneFormats the numbers of this row for labels and the tooltip.

bulletLegend / BulletTable

PropTypeDefaultDescription
data (required)readonly BulletItem[]NoneThe bullet rows to list, the same items the chart draws.
format((n: number) => string)formatCompactFormats each number in the table.
captionstringNoneVisually hidden caption naming the table for screen readers.
labelsPartial<BulletChartLabels>defaultBulletChartLabelsEvery other string, for translation: labels={{ instructions: "…" }}; omitted keys keep the English of defaultBulletChartLabels. All 12 keys of BulletChartLabels are listed in the key table under the props table.
bulletLegend(labels?, color?, rangeCount?)LegendItem[]NoneLegend items for ChartCard: actual, target and the range shades.

Keyboard

KeysAction
TabFocus the chart. It is one tab stop; the arrow keys then read it.
↑/↓/←/→Move between rows.
Home/EndJump to the first / last row.
EscapeClear the reading.

Accessibility

  • The chart is a focusable figure named by its aria-label (the chart title), with a one-line reading hint as its description and, inside a ChartCard with a table view, aria-details pointing at that table; moving through it announces each value politely, once. Each move announces the row's actual, target and delta.
  • BulletTable is the table view: pair it with ChartCard's table prop (Chart / Table tabs) so every value can be read without color or sight.
  • Under reduced motion nothing morphs: the bars and the target tick render at their final values and new data replaces the old at once.

All exports on this page

  • BulletChart — One bullet graph per row: a bar for the measure, a marker for its target and shaded ranges (poor, fair, good) behind it.
  • BulletTable — The chart's table view: every row's actual, target, range and delta, in text.
  • bulletLegend — Legend for a bullet chart: the measure, the target marker, and the range shades.
  • defaultBulletChartLabels — The built-in English strings of BulletChart; spread it into your own labels and change what you need.

When to use the bullet chart

  • Use it as a KPI bullet graph for a scorecard where each row has an actual value, a target marker and poor, fair and good ranges, such as revenue against plan, NPS against goal or churn against ceiling.
  • Use it when a gauge per metric would take too much space: one bullet graph fits in a single row, so a stack of KPIs stays compact on a dashboard.
  • Set higherIsBetter to false on cost or churn rows so the delta under the value is colored by whether beating the target is good, and use scale shared when every row has the same unit.
  • Skip it when you have one hero metric that deserves a big display, because a Gauge gives a single number its own room, or when you need history, where a Line chart is the better fit.
  • Pair it with ChartCard and the BulletTable view for an accessible text view, plus a Badge next to the card title to flag how many KPIs missed their target.

Frequently asked questions

48 charts pages in all: browse them on Charts.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .