Skip to content

Atoms · Score ring

Score ring

One 0 to 100 score shown as a ring with the number in its centre, split into bands the way Lighthouse (Google’s website audit tool) bands its scores. It’s a meter, so a screen reader, the software that reads the page aloud, hears both the score and its band.

Best for
A 0 to 100 score with good and bad bands, like an audit, a health check or a quality score. Several side by side read as one report.
Not for
Progress through a task: use Progress. A number with a change over time: use Stat. Parts of a whole: use a donut ChartPanel.

This page as Markdown, a plain-text copy for a coding agent (an AI tool that writes code).

Examples

A report like Lighthouse (Google's website audit tool): four scores in a row

42Performance
98Accessibility
77Best practices
100SEO
Code
tsx
<ScoreRing label="Performance" value={42} /><ScoreRing label="Accessibility" value={98} /><ScoreRing label="Best practices" value={77} /><ScoreRing label="SEO" value={100} />

Sizes: sm, md and lg

64Stock health
64Stock health
64Stock health
Code
tsx
<ScoreRing label="Stock health" value={64} size="sm" /><ScoreRing label="Stock health" value={64} /><ScoreRing label="Stock health" value={64} size="lg" />

The band boundaries: 49, 50, 89 and 90

49Depot A
50Depot B
89Depot C
90Depot D
Code
tsx
<ScoreRing label="Depot A" value={49} size="sm" /><ScoreRing label="Depot B" value={50} size="sm" /><ScoreRing label="Depot C" value={89} size="sm" /><ScoreRing label="Depot D" value={90} size="sm" />

Anatomy

PartWhat it is
RingA hairline track plus an arc as long as the score, with square (butt) ends.
Arc colourSet by band: hostile below 50, warning from 50 to 89, ok from 90. Colour is never the only signal, because the number is always printed.
TicksThree marks outside the ring at 0, 50 and 90. They mark the start and the two band boundaries.
NumberThe score in display figures, centred in the ring.
LabelMono (a monospaced font), uppercase, under the ring. It’s also the meter’s accessible name, the name assistive tech announces for it.

Props

labelstring
Required. What’s being scored. It’s both the accessible name and the caption.
valuenumber
Required. 0 to 100, clamped and rounded to a whole number.
size'sm' | 'md' | 'lg'Default 'md'
The ring is 56, 96 or 128px (pixels) wide.
classNamestring
Merged with the meter’s classes. Later Tailwind utilities (Tailwind is the CSS framework the system uses) win.
refRef<HTMLDivElement>
Points to the meter.
...restOmit<HTMLAttributes<HTMLDivElement>, 'children'>
Every native div prop except children, spread onto the meter. The ring draws its own content.
scoreBand()(value: number) => 'hostile' | 'warning' | 'ok'
The banding the ring uses. It’s exported so a table or a sentence beside the ring agrees with it.

Keyboard

You can't reach this component with the keyboard. It has no keyboard behaviour of its own.

Do and don't

Do

  • Put several rings in a row for one report, like Lighthouse’s four scores.
  • Name what’s being scored in a word or two.
  • State the weakest score in the sentence beside the rings.

Don't

  • Don't use it for a value that isn't out of 100. Rescale it first, or use Stat.
  • Don't colour the number. The arc carries the band, and the number stays text.primary.