Progress
A native progress indicator for a known amount of work.
Overview
Progress renders a native progress element. Pass value and max when the amount is known. Omit value when it is not.
The track and fill use semantic colors. The element keeps the browser progress semantics, including the current value, instead of a generic bar.
Preview
Customize
Installation
Add the component with the CLI. It copies the files in and installs anything they depend on.
npx vinyaas add progressUsage
import { Progress } from "@/components/ui/progress";
export function UploadProgress() {
return <Progress aria-label="Upload" value={40} max={100} />;
}Examples
Determinate
value and max describe how much of the work is complete.
Custom max
max can match a count, such as 3 of 8 files.
Indeterminate
Omit value when the duration is unknown. The element stays a native progress indicator without a fill.
In practice
An upload panel shows the file name, percent complete, status copy, and a Cancel action beside Progress.
2 of 5 MB uploaded. Keep this tab open until the transfer finishes.
API
Other attributes for the underlying element are passed through.
| Name | Type | Default | Description |
|---|---|---|---|
value | number | — | Current amount. Omit it for the native indeterminate state. |
max | number | 1 | Maximum amount. The browser default is 1. |
className | string | — | Merged onto the progress element with cn. |
Accessibility
The element is a native progress bar. Assistive technology reads its value and maximum. It does not add a separate ARIA role.
- Name it with
aria-labelor a label, because the bar has no visible text. - A missing
valueis the indeterminate state. A value of 0 is empty progress, not indeterminate. - The browser default
maxis 1. Set it when the scale is different.