- Components
- Feedback
- Progress Bar
Progress Bar
Progress bar show either determinate or indeterminate progress of an operation over time.
Installation
Anatomy
Visual 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"
.
Labelling
Label
A visual label can be provided 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.
Value
Value scale
A custom value scale can be used by setting the minValue
and maxValue
props.
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.
Composition
If you need to customize things further, you can drop down to the composition level.
API Reference
Prop | Type | Default | Description |
---|---|---|---|
variant | "primary" | "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. |
duration | `${number}s` | `${number}ms` | '0s' | The estimated duration of an indeterminate progress. |
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. |