Demos

A ring with the progress as a percentage.

Usage

Use circular progress for work in flight when space is tight: a file upload, a sync, results being processed. It fits beside a label, inside a button or in a card corner. Use a progress bar when there is room for one, and a gauge to show a measurement rather than a task.

Import it from @workspace/ui/components/circular-progress.

For the common case, CircularProgressCombined renders the indicator, track, range and value text for you.

Anatomy

  • CircularProgress — The root. Holds the value and geometry, and has the progressbar role.
  • CircularProgressIndicator — The SVG that draws the ring. Put CircularProgressTrack and CircularProgressRange inside it.
  • CircularProgressTrack — The full ring, in a muted colour.
  • CircularProgressRange — The filled arc, up to the current value. It starts at the top and fills clockwise.
  • CircularProgressValueText — The text centred over the ring. Defaults to a percentage.

Notes

  • Give the root an aria-label so screen readers know what is loading.
  • Pass getValueText to change the text read by screen readers and shown by default. Pass children to CircularProgressValueText to change only what is shown.
  • Colour the fill with a text colour class on CircularProgressRange, for example text-chart-2. The ring uses currentColor.
  • The default value text is text-sm. On small rings, shrink it or leave CircularProgressValueText out.
  • Keep thickness well below size, or the ring will not draw properly.
  • The indeterminate spin turns off when the reader prefers reduced motion.

Examples

Sizes

Change size and thickness together so the ring keeps its weight.

Custom value

Set max for a count that is not 0–100, colour the range, and pass children to CircularProgressValueText to show a count and caption.

Indeterminate

Set value={null} when you do not know how long the task will take. A quarter arc spins around the track.

Props

These are the props you set most often. Unlisted props pass through to the underlying element.

CircularProgress

PropTypeDefaultDescription
valuenumber or nullnullCurrent value. null is indeterminate. Clamped to min–max.
minnumber0Lowest value.
maxnumber100Highest value.
getValueText(value, min, max) => stringPercentageText for screen readers and the default CircularProgressValueText.
sizenumber48Width and height in pixels.
thicknessnumber4Stroke width of the ring.
renderReactElement or function—Replaces the root div with your own element.
classNamestring—Classes merged onto the root.

Data attributes

CircularProgressIndicator, CircularProgressTrack and CircularProgressRange set data-state to indeterminate, loading or complete, so you can style each state, for example data-[state=complete]:text-chart-2.