Progress bar
vig-progress-bar
import { ProgressBar } from '@vigdx/ui/progress-bar';Basic
value is a percentage from 0 to 100 (clamped and rounded). showValue prints it next to the bar; ariaLabel names the bar for screen readers.
Variants
variant colors the fill with the shared hues, e.g. success once a task is done or warning and error for a nearly full quota.
Sizes
size sets the track height to sm , md (default) or lg , relative to the font size. The bar fills the width of its container.
Indeterminate
value at null when the remaining work is unknown: a segment sweeps along the track, or the bar stays static with reduced motion.
Live progress
value to a signal and the fill animates between updates. Switching the variant on completion confirms the result.
Labels
ariaLabel and valueTemplate ( {0} is the rounded value) are inputs for translations; the template also feeds aria-valuetext . App-wide defaults come from the progressAriaLabel and progressValueTemplate labels.
Styling hooks
Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="progress-bar"][data-part="track"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.
Scope: [data-scope="progress-bar"]
| Part | Element | data-state |
|---|---|---|
track | <progress> ; the fill is its pseudo-element. | — |
value | showValue ). | — |
Accessibility
- Renders a native
<progress max="100">, which the platform exposes as a progress bar with its value, plus a formattedaria-valuetext; indeterminate bars omit the value. - Always give each bar a specific
ariaLabel, or point at a visible heading withariaLabelledby(ariaDescribedbyadds a description); the generic default (“Progress”) does not tell users what is progressing. - Screen readers do not announce every value change. For long tasks, also announce milestones or completion in a live region such as a toast.
- The fill animation and the indeterminate sweep respect
prefers-reduced-motion: the sweep slows down rather than stopping, so the bar still reads as busy.
API
ProgressBar
vig-progress-barLinear progress indicator: a native <progress>, so the progressbar role
and value come from the platform. A value of 0–100 renders a determinate
bar; null renders an indeterminate sweep (slowed down, never stopped,
with reduced motion, so it still reads as busy).
| Name | Type | Default | Description |
|---|---|---|---|
ariaDescribedby | string | undefined | undefined | Ids of elements describing the bar. A static |
ariaLabel | string | undefined | undefined | Accessible name; defaults to the |
ariaLabelledby | string | undefined | undefined | Ids of elements naming the bar, e.g. a visible heading; wins over
|
showValue | boolean | false | Renders the formatted percentage next to the bar (determinate only). |
size | ProgressBarSize | 'md' | — |
value | number | null | null | Percentage complete (0–100, clamped); |
valueTemplate | string | ((value: number) => string) | undefined | undefined | Percentage text: a function of the rounded value, e.g.
|
variant | ProgressBarVariant | 'primary' | — |