Skip to content
Calm motion: animations on this site only fade, with no movement

Bullet chart ​

One value against a target and bands, in one thin bar

Shows one key number with its goal and how good it is, in a row that takes little space. Put a few in a stack for a page of key numbers. For a value in a ring, use the gauge. For a plain bar with no target, use the progress bar.

Basic
Completion
Plays
Rating
New members
  • label is the name at the start of the row, and value is the number. The value is the thin bar, and its text is at the end of the row.
  • target draws a line across the bar at the goal.
  • bands are the ends of the bands, from low to high, for example [50, 80, 100]. The first band has the strongest shade and means poor. The last band has the faintest shade and means good.
  • The scale goes from min (default 0) to max. With no max, the scale ends at the last band, or at a round number above the value and the target. A value past the end fills the bar.
  • The labels of all rows have the same width, so the bars line up. Set the width with the --bless-bullet-label CSS variable (default 8rem).
  • color sets the color of the value bar, as a token name or any CSS color (default chart-1). format sets the text of a value.
  • For screen readers, the bar is a meter. It says the value, the target, and the name of the band, for example "72%, target 80%, fair". Change the words with labels or a label pack: target, and band (a function of the place of the band and the number of bands).

Usage ​

ts
import { BlessBulletChart } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
label*string—the name of the number, at the start of the row
value*number—
targetnumber—the goal, drawn as a line across the bar
bandsnumber[][]the ends of the bands, low to high, for example `[50, 80, 100]` for poor, fair, and good
minnumber0
maxnumber—the end of the scale; default: the last band, or a round number above the value and the target
colorstring"chart-1"
format((v: number) => string)—text for one value, for example `(v) => v + "%"`
labelsPartial<{ target: string; band: (index: number, count: number) => string; }>—

Released under the MIT License. Character names and artwork belong to their owners.