Atoms · Segmented meter
Segmented meter
A row of small squares for a count out of a small total: filled, empty, or struck through for a step that does not apply. It reads at a glance where a bar would need a number beside it.
- Best for
- Showing a small count out of a small total, such as 3 of 5 checks passed, where each unit matters.
- Not for
- A percentage or a large total: use Progress.
This page as Markdown, a plain-text copy for a coding agent (an AI tool that writes code).
Examples
Checks passed, in the accent
3/5
Code
tsx
<SegmentedMeter label="Checks passed" value={3} max={5} /><span className="font-data text-sm text-[var(--color-text-secondary)]">3/5</span>Struck squares: steps that do not apply
Code
tsx
<SegmentedMeter label="Release steps" value={2} max={6} none={2} valueText="2 of 6 done, 2 not needed" tone="teal" />Category tones
Code
tsx
<SegmentedMeter label="Blue" value={4} max={8} tone="blue" /><SegmentedMeter label="Green" value={6} max={8} tone="green" /><SegmentedMeter label="Purple" value={2} max={8} tone="purple" />Anatomy
| Part | What it is |
|---|---|
| Meter | A div with role="meter", named by label, with its value spoken as valueText. |
| Filled squares | Painted in the tone: accent.signal.fill, or a category fill. |
| Empty squares | A one-pixel text.muted outline, which passes the 3:1 graphic floor on every surface. |
| Struck squares | An empty square with a diagonal line: a step that does not apply. |
Props
- valuenumber
- Required. How many squares are filled. Clamped to 0 to max.
- maxnumber
- Required. How many squares there are. Keep it to about 12; past that, use Progress.
- nonenumberDefault 0
- Squares after the filled ones that are struck through, for steps that do not apply.
- tone'signal' | CategoryColorDefault 'signal'
- The fill. signal is the accent; the rest are the category fills.
- labelstring
- Required. The accessible name, for example "Checks passed".
- valueTextstring
- What a screen reader says for the value. Defaults to "{value} of {max}".
- classNamestring
- Merged with the component's classes.
- refRef<HTMLDivElement>
- Passed through to the meter div.
- ...restHTMLAttributes<HTMLDivElement>
- Every native attribute, passed onto the meter div.
Keyboard
You can't reach this component with the keyboard. It has no keyboard behaviour of its own.
Do and don't
Do
- Put the number in words nearby, or in valueText, so the meter is never the only place the value lives.
- Use signal for the one meter on a screen that asks for action; a category fill otherwise.
Don't
- Don’t use more than about 12 squares: they stop being countable.
- Don’t use struck squares for failed steps. They mean "does not apply"; a failure is a status with a word.