Skip to content

Progress

Shows how far a task has come, from 0 to 100%.

Library
What’s this?
Importing accounts

Installation

pnpm dlx shadcn@latest add @wisty/progress

The CLI installs the Radix or Base UI file to match your project.

If your project doesn't have Wisty UI's theme yet, add it once with npx shadcn@latest add @wisty/cosmos. Until then, components keep shadcn's default look. Installation has the details.

When to use

Use it

  • A task takes more than a moment and you know how far along it is: an upload, an import, a batch update.
  • To show how much of something is used or done, like a quota or a checklist, as a bar.

Don't use it

  • You don't know how long it will take. Use Spinner.
  • Content is loading into a known layout. Use Skeleton.
  • Steps with names, like a guided setup. Use Path.
  • People set the value. Use Slider.

Usage

Pass a value and a name.

import { Progress } from "@/components/ui/progress"
<Progress value={40} aria-label="Import progress" />

The bases differ for a label, a value text and classes:

  • In Radix projects, Progress is the bar alone, and classes on it land on the bar. Put the label and the value in your own markup above it, point aria-labelledby at the label and mark the value text aria-hidden, as the Importing accounts example shows.
  • In Base UI projects, put ProgressLabel and ProgressValue inside Progress. They sit in a row above the bar, and the label names it. ProgressValue shows "25%" on its own, or takes a function of that text, like {(text) => `${text} complete`}. The bar is a track inside Progress, so reach it with [&_[data-slot=progress-track]]:, as the Sizes example does.

Examples

Sizes

SLDS's x-small, small, default and large heights and its circular bar, set with `h-*` and `rounded-full` classes on the bar.

API reference

Progress

Also takes every Radix Progress.Root (opens in a new tab) prop.

SLDS mapping

The bar is slds-progress-bar and the fill is slds-progress-bar__value, as wide as the value. In Base UI projects, ProgressLabel and ProgressValue draw SLDS's labelled bar. SLDS's other heights and the circular bar aren't props: the Sizes example sets them with classes.

Known gaps:

  • No vertical bar (slds-progress-bar_vertical) and no green value (slds-progress-bar__value_success).

Accessibility

  • Name every bar: aria-label, or aria-labelledby pointing at a visible label. ProgressLabel does it where it exists.
  • With value={null}, the bar is indeterminate: empty, with no aria-valuenow. Pass null while you don't know yet, not 0.
  • Screen readers don't announce the value as it moves. Announce the end of a long task somewhere else, like a toast.

Motion

  • The fill doesn't animate, so a change jumps to the new width.

Responsive behavior

  • The bar fills its container's width. Put it in a container with a width, or use max-w-*.

Rules

  • Pass value as a number from 0 to 100. A fraction like 0.25 draws a near-empty bar.
  • Don't restyle the colors. They come from the theme.