Progress Ring
A large ring that shows how far a load really is, with eased jumps that never move backward and rich styling controls.
Paced by a Load's Steps
Give the ring a value from 0 to 100. It never draws less than it already has, and a rise of more than 2
points eases over 300ms (InOutQuad), so a step that lands early jumps smoothly instead of snapping.
To show how far a load really is, pace it with useProgressRingPace: pass each step's usual time
(plan), when each step landed (marks) and whether the data has arrived. The ring is held to
the landed steps, creeps toward the next at the usual pace but never past 90% of its share, keeps
closing on 95% when a step runs late, and reaches 100 only when the data arrives. ticks cuts a
notch in the track where each step ends.
Set delay={600} so a quick load never flashes the ring. Start a new load with a new key.
States
note adds a quiet second line (a slow or stalled load). state="failed" drains the arc and holds
it where it stopped, with a warning mark. state="done" closes the arc, then grows a touch and fades
out over 200ms while the screen draws under it.
Looks
Every look is a token with a prop to override it: size, stroke and track width, the gradient's
stops (colors), its kind (conic, linear or solid) and angle, round or flat caps, blur on the
ring, a frosted track (trackBlur), and the lustre (--progress-ring-sheen, 0 to 1). Over a photo,
--progress-ring-frost puts a frosted-glass disc behind the ring.
Theming
A theme binds any --progress-ring-* token from its yaml under components.progress-ring, for
example from, to, stroke, sheen or frost. The full list, with every default, is in
Component Tokens.
Installation
npx visor add progress-ringThis copies three files into your project:
components/ui/progress-ring/progress-ring.tsx: the componentcomponents/ui/progress-ring/progress-ring.module.css: the stylescomponents/ui/progress-ring/progress-ring-pace.ts:useProgressRingPaceand its pure pacing rules
API Reference
ProgressRingProps
| Prop | Type | Default | Description |
|---|---|---|---|
value* | number | — | How far, 0 to 100. The ring never draws less than it already has; start a new load with a new key. A rise of more than 2 points eases over the jump duration; smaller rises draw at once. |
label* | string | — | What is loading, in the person's words. The progressbar's name; shown under the ring with showLabel and announced through a role="status". |
showLabel | boolean | false | Show the label under the ring. |
note | ReactNode | — | A second line under the label (a slow or stalled load), announced with it. |
showValue | boolean | true | The percentage in the middle. |
state | 'loading' | 'done' | 'failed' | 'loading' | done closes the arc, then grows a touch and fades. failed drains the arc, holds it where it stopped and shows a warning mark. |
ticks | number[] | — | Where each step ends, 0 to 1: a notch cut through the track at each. |
delay | number | — | Fade in only after this many ms, so a quick load never flashes the ring. |
jumpDuration | number | — | A jump's ease, in ms. Overrides --progress-ring-jump-duration (--motion-duration-300). |
easing | (k: number) => number | inOutQuad | The jump's easing, 0 to 1 in and out. |
size | number | — | Diameter in px. Overrides --progress-ring-size (160px). |
stroke | number | — | Arc stroke in px. Overrides --progress-ring-stroke (8px). |
trackWidth | number | — | Track width in px. Overrides --progress-ring-track-width (the stroke). |
colors | string[] | — | Gradient stops, start to head; one colour is solid. Overrides --progress-ring-from / -via / -to. |
trackColor | string | — | Overrides --progress-ring-track. |
gradient | 'conic' | 'linear' | 'solid' | 'conic' | conic stretches the stops along the arc, so the head always carries the last colour; linear lays them across the ring at angle. |
angle | number | — | A linear gradient's angle, in degrees. |
cap | 'round' | 'flat' | 'round' | The arc's ends. |
blur | number | — | Blur on the ring itself, in px. |
trackBlur | number | — | Backdrop blur through the track, in px (a frosted track over a photo). |
The component also accepts all standard <div> HTML attributes, on the root.
Accessibility
- The ring is a
role="progressbar"named bylabel, witharia-valuenowin round tens: it is read when the person moves to it, not announced as it moves. - The label and note sit in a
role="status", so a change to the words is announced. - With
prefers-reduced-motion: reducethe ring draws each value at once (no easing) and the hand-off fades without growing;useProgressRingPaceshows only the landed steps.