Progress
A bar, circle or half circle that shows how much of a task is done when the amount is known: an upload, an import, storage used. Each shape is Slider's 12px track, and a bar is a flat rail like it. The accent is the part that is done. The remainder is its own hatched track with a 1px border, 4px away, and there is no stop dot. With no value it shows that work runs without saying how much is left. label names the task, and showValue adds the percentage.
Preview
Usage
When to use
- Show how much of a task is done when the amount is known: an upload, an import, the files of a sync.
- A task long enough for the user to wait on, named above the bar.
When not to use
- Work whose amount is never known, such as checking a value. Use Spinner.
- Content whose layout you know while it loads, such as a list. Use Skeleton.
- The steps of a flow the user moves through, such as a setup wizard.
Platform support
What each platform has, from the spec. A selected platform is highlighted.
| Name | Web | iOS | Android | Note |
|---|---|---|---|---|
| variant | Yes | Yes | Yes | |
| value | Yes | Yes | Yes | |
| max | Yes | Yes | Yes | |
| size | Yes | Yes | Yes | |
| label | Yes | Yes | Yes | |
| showValue | Yes | Yes | Yes |
Variants
variant
bar is the track. circle is a full ring. semicircle is the top half, open along the bottom.
size
On a circle or half circle, sm is 80px across and md is 112px. The stroke stays 12px at both, the same as the bar.
Examples
Upload
A count of files
max is the real count, so the bar and its percentage follow the files done.
Unknown amount
No value: the bar shows that work runs, not how much is left.
Named elsewhere
A bar in a card row whose name is already on screen.
Circle
One share, such as storage used. The percentage sits in the ring.
Half circle
The same ring, open along the bottom. The hatched arc stays 4px from the accent.
Do and don't
Do
- Name the task in the label, and use the real count as max (12 files) when there is one.
- Show the percentage when the task takes long enough for the user to wait on it.
- Say in text when a long task is done or has failed; the meter alone is not announced.
- Use a circle or a half circle for one share in a small space, such as storage used. Use the bar for a task with its name above it.
Don't
- Don't use it when the amount is never known. Use Spinner.
- Don't show one bar per step of a single task; one meter covers the whole task.
- Don't use it for the steps of a flow the user moves through.
- Don't let a bar run the full width of a page. Give it a length, about 256px, the same as Slider.
Props
| Name | Type | Values | Default | Description |
|---|---|---|---|---|
| variant | enum | bar | circle | semicircle | bar | bar is the track. circle is a full ring. semicircle is the top half, open along the bottom. |
| value | number | - | - | How much is done, from 0 to max. Leave it out, or pass null, when the amount is unknown: the meter is indeterminate. |
| max | number | - | 100 | The value when the task is done. Use the real count (12 files) and pass the count done as value. |
| size | enum | sm | md | md | On a circle or half circle, sm is 80px across and md is 112px. The stroke stays 12px at both, the same as the bar. |
| label | node | - | - | The visible name above the meter: what is in progress, Uploading report.pdf. Without it, set aria-label or aria-labelledby. |
| showValue | boolean | - | false | Shows the percentage: at the end of the label row on a bar, in the middle of a circle, along the bottom of a half circle. Screen readers get it either way. |
Anatomy
| Part | Description |
|---|---|
| root | The meter. A bar is 12px tall and as wide as its parent. A circle is a ring, 80px (sm) or 112px (md) across. A half circle is the top half of that ring. The stroke is 12px, the same as the bar. |
| indicator | The accent track from the start, as long as the share of the work that is done, radius-full. On a circle or half circle it is the accent arc. It stops 4px short of the hatched track. With no value, a third of the meter that pulses, with the hatched track 4px away on both sides. |
| track | The remainder as its own hatched track with a 1px border, radius-full, 4px (spacing-xs) from the accent. At 0% it is the whole meter. At 100% it is absent. On a circle or half circle it is the hatched arc with the same 1px border. |
| wrapper | With label, or with showValue on a bar: the column that holds the label row above the track, gap-xs. |
| header | The label row: the label, then on a bar the percentage at the end, gap-sm. |
| label | 14px medium primary text that names the task. |
| value | With showValue: 14px secondary text with tabular figures. On a bar it sits at the end of the label row. On a circle it sits in the middle of the ring. On a half circle it sits along the bottom. |
Accessibility
Role: progressbar
- Always named: the label prop (linked with aria-labelledby), or aria-label or aria-labelledby when the name is shown elsewhere. The type requires one.
- aria-valuenow, aria-valuemin and aria-valuemax follow value and max; aria-valuetext reads the percentage (40%). With no value, the meter is indeterminate and has neither. A circle and a half circle use the same role and values.
- The visible percentage (showValue) is hidden from screen readers, since they read aria-valuetext on the meter.
- The fill grows only when the user allows motion, and the indeterminate pulse stops under prefers-reduced-motion.
- A progress meter is not a live region. For a long task, also say in text when it is done.
Install
npx werewolf-ui add progressRun npx werewolf-ui init once in your app before adding components. Init sets up tokens, their CSS import and agent rules. Add installs this component and its dependencies while preserving your theme. See Installation for requirements and the alternative registry setup.