Progress
Shows how far a task has come when its length is known.
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/progressUploading records…60%
Anatomy
Indexing records
- 1Label
data-slot="progress-label"text-sm · font-medium - 2Value
data-slot="progress-value"text-sm · text-muted-foreground - 3Track
data-slot="progress-track"bg-border · h-3 - 4Indicator
data-slot="progress-indicator"bg-primary
Clinia rules
- The indicator is
primaryon abordertrack. The track is decorative; the indicator carries the value. - Pair the bar with a
ProgressLabelthat names the task (Indexing records) and aProgressValuethat shows the number. sizeisdefault(12px),sm(6px) orxs(4px). Usexsfor a table row or a file item, as File Upload does.
Do and don't
Indexing records
Connecting to the source
Connecting to the source
States
0%
Uploading records
60%
Uploading records
100%
Uploading records
indeterminate
size sm
size xs
Toggle the site theme to review both themes.
Accessibility
Built in
- Base UI renders
role="progressbar"witharia-valuenow,aria-valueminandaria-valuemax.ProgressLabelnames it; avalueofnullmakes it indeterminate.
Your responsibility
- Name the bar: put a
ProgressLabelinside it, or giveProgressanaria-labelwhen 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
- With a screen reader, move to the bar: it announces the label, progress bar, and the percentage.
- Let the task finish: the result is written out, not shown by the bar alone.
- Turn on reduced motion: the indeterminate segment stops sliding and becomes a still, faint full-width bar.
API
| Prop | Values | Default | Description |
|---|---|---|---|
| size | defaultsmxs | default | Height: |
All other props come from Base UI Progress.
Related