Demos

A labelled bar with a percentage.

Usage

Use a progress bar when a task takes more than a second and you know how much is left: an upload, an analysis, an onboarding flow. Set value to null when you cannot tell how long it will take.

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

Anatomy

  • Progress — The root. Renders the track and indicator for you.
  • ProgressLabel — Names the task. Read by screen readers.
  • ProgressValue — Shows the current value. Defaults to a percentage.
  • ProgressTrack and ProgressIndicator — The bar and its fill. Progress renders them for you, so do not add them as children.

Notes

  • Without a ProgressLabel, give the root an aria-label.
  • Pass a function as the child of ProgressValue to format the text. It gets the formatted value and the raw value, so you can show "4 of 6 steps".
  • Do not use a progress bar to show a health score. It reads as a task, not a measurement.

Examples

Custom value

Set max and pass a function to ProgressValue to show steps instead of a percentage.

Without label

A bar on its own. Give it an aria-label.

Indeterminate

Set value={null} when the duration is unknown. The fill shrinks to a third of the track and pulses.

Props

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

Progress

PropTypeDefaultDescription
valuenumber or null—Required. Current value. null is indeterminate.
minnumber0Lowest value.
maxnumber100Highest value.
formatIntl.NumberFormatOptions—Formats the text in ProgressValue.
classNamestring—Classes merged onto the root.