- Components
- Feedback
- Progress
Progress
Progress shows the completion progress of a task in shape of a bar, displayed as a progress bar..
Installation
Usage
Use Progress
to show the completion progress of a task. It can represent either determinate or indeterminate progress.
Best pratices
When possible, use a determinate progress indicator.
An indeterminate progress indicator shows that a process is occurring, but it doesn’t help people estimate how long a task will take.
A determinate progress indicator can help people decide whether to do something else while waiting for the task to complete, restart the task at a different time, or abandon the task.
Options
Variant
Use the variant
prop to control the visual style of the Progress
. The default variant is "default"
.
Size
Use the size
prop to control the size of the Progress
. The default variant is "md"
.
Label
A visual label can be provided for the Progress
using the label prop, or a hidden label using aria-label
prop.
Value label
Set the showValueLabel
prop to true
to display the current value of the progress bar.
Format options
Values are formatted as a percentage by default, but this can be modified by using the formatOptions
prop to specify a different format.
Custom value label
The valueLabel
prop allows the formatted value to be replaced with a custom string.
Indeterminate
The isIndeterminate
prop can be used to represent an interdeterminate operation.
Duration
Use the duration prop to indicate an approximate duration of an indeterminate task. Once the duration times out, the progress bar will start an indeterminate animation.
Min and max values
A custom value scale can be used by setting the minValue
and maxValue
props.
Examples
Composition
If you need to customize things further, you can drop down to the composition level.
Custom color
Toolbar
API Reference
Prop | Type | Default | Description |
---|---|---|---|
variant | "default" | "primary" | "danger" | "success" | "warning" | "default" | The visual style of the progress indicator. |
size | "sm" | "md" | "lg" | "md" | The size of the progress indicator |
isIndeterminate | boolean | - | Whether presentation is indeterminate when progress isn't known. |
formatOptions | Intl.NumberFormatOptions | {style: 'percent'} | The display format of the value label. |
valueLabel | ReactNode | - | The content to display as the value's label (e.g. 1 of 4). |
showValueLabel | boolean | false | Whether the value's label is displayed. |
value | number | 0 | The current value (controlled). |
minValue | number | 0 | The smallest value allowed for the input. |
maxValue | number | 100 | The largest value allowed for the input. |
children | ReactNode | (values: ProgressBarRenderProps & {defaultChildren: ReactNode | undefined}) => ReactNode | - | The children of the component. A function may be provided to alter the children based on component state. |
className | string | - | The CSS className for the element. |
style | CSSProperties | (values: ProgressBarRenderProps & {defaultStyle: CSSProperties}) => CSSProperties | - | The inline style for the element. A function may be provided to compute the style based on component state. |
CSS Selector | Description |
---|---|
[aria-valuetext] | A formatted version of the value. |
:not([aria-valuenow]) | Whether the progress bar is indeterminate. |