Clinia UI

Progress

Shows how far a task has come when its length is known.

shadcn docs →

When to use

  • Show how far a task has come when its length is known: an upload, an import, an indexing job.

When not to use

  • Work of unknown length: use Spinner.
  • Loading content into a known layout: use Skeleton.
  • A value the user sets: use Slider.

Install

npx shadcn@latest add @clinia/progress
Uploading records…60%
x

Anatomy

Indexing records
x
  1. 1Labeldata-slot="progress-label"text-sm · font-medium
  2. 2Valuedata-slot="progress-value"text-sm · text-muted-foreground
  3. 3Trackdata-slot="progress-track"bg-border · h-3
  4. 4Indicatordata-slot="progress-indicator"bg-primary

Clinia rules

  • The indicator is primary on a border track. The track is decorative; the indicator carries the value.
  • Pair the bar with a ProgressLabel that names the task (Indexing records) and a ProgressValue that shows the number.
  • size is default (12px), sm (6px) or xs (4px). Use xs for a table row or a file item, as File Upload does.

Do and don't

Indexing records
x
Do name the task and show the number.
x
Don't show a bare bar with nothing to say what it measures.
Connecting to the source
Do use a spinner when you can't tell how long it will take.
Connecting to the source
x
Don't fake a percentage for work of unknown length.

States

0%
Uploading records
x
60%
Uploading records
x
100%
Uploading records
x
indeterminate
x
size sm
x
size xs
x

Toggle the site theme to review both themes.

Accessibility

Built in

  • Base UI renders role="progressbar" with aria-valuenow, aria-valuemin and aria-valuemax. ProgressLabel names it; a value of null makes it indeterminate.

Your responsibility

  • Name the bar: put a ProgressLabel inside it, or give Progress an aria-label when the label would repeat nearby text.
  • Say when the task ends. When it finishes or fails, replace the bar with a written result, not only a full or empty bar.

How to test

  1. With a screen reader, move to the bar: it announces the label, progress bar, and the percentage.
  2. Let the task finish: the result is written out, not shown by the bar alone.
  3. Turn on reduced motion: the indeterminate segment stops sliding and becomes a still, faint full-width bar.

API

PropValuesDefaultDescription
size
defaultsmxs
default

Height: default 12px, sm 6px, xs 4px, for a table row or a file item.

All other props come from Base UI Progress.