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
labelis the name at the start of the row, andvalueis the number. The value is the thin bar, and its text is at the end of the row.targetdraws a line across the bar at the goal.bandsare 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) tomax. With nomax, 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-labelCSS variable (default8rem). colorsets the color of the value bar, as a token name or any CSS color (defaultchart-1).formatsets 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
labelsor a label pack:target, andband(a function of the place of the band and the number of bands).
Usage
ts
import { BlessBulletChart } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
label* | string | — | the name of the number, at the start of the row |
value* | number | — | |
target | number | — | the goal, drawn as a line across the bar |
bands | number[] | [] | the ends of the bands, low to high, for example `[50, 80, 100]` for poor, fair, and good |
min | number | 0 | |
max | number | — | the end of the scale; default: the last band, or a round number above the value and the target |
color | string | "chart-1" | |
format | ((v: number) => string) | — | text for one value, for example `(v) => v + "%"` |
labels | Partial<{ target: string; band: (index: number, count: number) => string; }> | — |