VisorVisor
ComponentsData Display

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.

Loading Your Projects

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.

Loading
Still LoadingTaking longer than usual
Couldn't Load

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.

Conic
Linear
Hairline
Three Stops

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-ring

This copies three files into your project:

  • components/ui/progress-ring/progress-ring.tsx: the component
  • components/ui/progress-ring/progress-ring.module.css: the styles
  • components/ui/progress-ring/progress-ring-pace.ts: useProgressRingPace and its pure pacing rules

API Reference

ProgressRingProps

PropTypeDefaultDescription
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".
showLabelbooleanfalseShow the label under the ring.
noteReactNode—A second line under the label (a slow or stalled load), announced with it.
showValuebooleantrueThe 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.
ticksnumber[]—Where each step ends, 0 to 1: a notch cut through the track at each.
delaynumber—Fade in only after this many ms, so a quick load never flashes the ring.
jumpDurationnumber—A jump's ease, in ms. Overrides --progress-ring-jump-duration (--motion-duration-300).
easing(k: number) => numberinOutQuadThe jump's easing, 0 to 1 in and out.
sizenumber—Diameter in px. Overrides --progress-ring-size (160px).
strokenumber—Arc stroke in px. Overrides --progress-ring-stroke (8px).
trackWidthnumber—Track width in px. Overrides --progress-ring-track-width (the stroke).
colorsstring[]—Gradient stops, start to head; one colour is solid. Overrides --progress-ring-from / -via / -to.
trackColorstring—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.
anglenumber—A linear gradient's angle, in degrees.
cap'round' | 'flat''round'The arc's ends.
blurnumber—Blur on the ring itself, in px.
trackBlurnumber—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 by label, with aria-valuenow in 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: reduce the ring draws each value at once (no easing) and the hand-off fades without growing; useProgressRingPace shows only the landed steps.