Progress bars
Show how far along work is.
Quick usage
Import the shared component; never copy its markup into a feature. The Web TSX tab beside the live stage has a complete, working example.
import ProgressBar from '@/shared/components/ProgressBar';Live stage and code
The live component and its controls on the left, the code on the right; change a control and the code follows: Web TSX (the component in a working example), Tailwind and HTML (the markup it renders, with its data attributes), React Native, SwiftUI and Jetpack Compose. The header theme switch drives every stage.
Props
Read from the component's source when the docs build: names and defaults from its signature, types and descriptions from its JSDoc. A blank type means the prop has no JSDoc yet.
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | 0 | - |
max | number | 100 | - |
tone | 'primary'|'in-progress'|'success'|'warning'|'error'|'info' | 'primary' | 'in-progress' is the Gantt's --bar-in-progress, for work under way. |
size | 'sm'|'md' | 'md' | md is 6px; sm is 4px, for a bar inside a dense row or a popover line where 6px would outweigh the text beside it. |
segments | - | null | - |
label | string | - | Accessible name ("Weld progress"). |
showValue | boolean | false | Print the percentage beside the bar. |
Source: frontend/src/shared/components/ProgressBar/ProgressBar.js
DOM contract
What the rendered element carries: the data attributes its styles key on, its roles and ARIA, its focus style, and whether its stylesheet draws the 44px hit boundary. Also read from the source.
| Data attributes | data-dsdata-sizedata-tone |
| Roles | role="progressbar" |
| ARIA | aria-labelaria-valuemaxaria-valueminaria-valuenow |
| Focus | No :focus-visible rule of its own |
| 44px hit boundary | Not a pressable root |
Accessibility and touch
Passive.
Progress bars is passive: it reports a condition and is not pressed, so it has no hit boundary. If a design makes it pressable, it gains the 44 by 44 boundary and is marked /* ds-chip: why */.
Rules and constraints
Use it for
- Task and job progress, receiving completion.
Avoid
- Never a bar without the figure beside it: a bar alone cannot be read exactly.
Constraints
- The track is --bg-active; the fill takes the status hue; figures in tabular numerals.