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.jsonQ3 performance
BulletChartBulletTablebulletLegenddefaultBulletChartLabels- +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
import { bulletLegend, BulletTable, BulletChart, type BulletItem } from "@/components/sheenui/charts/bullet-chart";
import { ChartCard } from "@/components/sheenui/charts/chart-parts/chart-card";
import { formatCompact } from "@/components/sheenui/charts/chart-utils";
// Package build (after the first npm release, or a packed tarball): import { formatCompact, ChartCard, bulletLegend, BulletTable, BulletChart, type BulletItem } from "@sheenui/theme";
const usdK = (n: number) => (n === 0 ? "$0" : `$${formatCompact(n)}K`);
const rows: BulletItem[] = [
{ label: "Revenue", description: "US$, thousands", value: 270, target: 250, ranges: [150, 225, 300], format: usdK },
{ label: "Profit", description: "Margin, %", value: 22.5, target: 26, ranges: [20, 25, 30], format: (n) => `${n}%` },
{ label: "Order size", description: "US$, average", value: 320, target: 550, ranges: [350, 500, 600], format: (n) => `$${formatCompact(n)}` },
{ label: "New customers", description: "This quarter", value: 1650, target: 2100, ranges: [1400, 2000, 2500] },
{ label: "Satisfaction", description: "Out of 5", value: 4.5, target: 4.2, ranges: [3.5, 4.25, 5], max: 5 },
];
<ChartCard
title="Q3 performance"
legend={bulletLegend()}
table={<BulletTable data={rows} caption="Q3 performance against targets" />}
>
<BulletChart data={rows} aria-label="Q3 performance against targets" />
</ChartCard>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.tsxcomponents/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.tslib/{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
import { BulletChart } from "@/components/sheenui/charts/bullet-chart";
import { formatCompact } from "@/components/sheenui/charts/chart-utils";
// Package build (after the first npm release, or a packed tarball): import { BulletChart, formatCompact } from "@sheenui/theme";
<BulletChart
scale="shared"
format={(n) => `${formatCompact(n)} ms`}
labels={{ ranges: ["Fast", "Acceptable", "Slow"] }}
data={[
{ label: "p50", value: 118, target: 150, ranges: [200, 400, 1000], higherIsBetter: false, color: 3 },
{ label: "p90", value: 342, target: 300, ranges: [200, 400, 1000], higherIsBetter: false, color: 3 },
{ label: "p99", value: 780, target: 900, ranges: [200, 400, 1000], higherIsBetter: false, color: 3 },
]}
aria-label="API latency against SLO targets"
/>Props
BulletChartLabels keys and English defaults (12)
BulletItem
bulletLegend / BulletTable
Keyboard
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
Related pages
48 charts pages in all: browse them on Charts.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .