Progress
The Progress component allows you to view the progress of any activity.
Installation
npx nextui-cli@latest add progress
The above command is for individual installation only. You may skip this step if @nextui-org/react
is already installed globally.
Import
Usage
Note: Make sure to pass the
aria-label
prop when thelabel
prop is not provided. This is required for accessibility.
Sizes
Colors
Indeterminate
You can use the isIndeterminate
prop to display an indeterminate progress bar.
This is useful when you don't know how long an operation will take.
Striped
With Label
Note: If you pass the
label
prop you don't need to passaria-label
prop anymore.
With Value
Value Formatting
Values are formatted as a percentage by default, but this can be modified by using the
formatOptions
prop to specify a different format. formatOptions
is compatible with the
option parameter of Intl.NumberFormat and is applied based on the current locale.
Slots
- base: The base slot of the progress, it is the main container.
- labelWrapper: The label and value label wrapper.
- label: The label of the progress.
- value: The value label of the progress.
- track: The track is the background bar of the progress.
- indicator: The indicator is the bar that is filled according to the
value
.
Custom Styles
You can customize the Progress
component by passing custom Tailwind CSS classes to the component slots.
Data Attributes
CircularProgress
has the following attributes on the base
element:
- data-indeterminate: Indicates whether the progress is indeterminate.
- data-disabled:
Indicates whether the progress is disabled. Based on
isDisabled
prop.
Accessibility
- Exposed to assistive technology as a progress bar via ARIA.
- Labeling support for accessibility.
- Internationalized number formatting as a percentage or value.
- Determinate and indeterminate progress support.
- Exposes the
aria-valuenow
,aria-valuemin
,aria-valuemax
andaria-valuetext
attributes.
API
Progress Props
Attribute | Type | Description | Default |
---|---|---|---|
label | ReactNode | The content to display as the label. | - |
size | sm | md | lg | The size of the indicator. | md |
color | default | primary | secondary | success | warning | danger | The color of the indicator. | primary |
radius | none | sm | md | lg | full | The progress border radius. | full |
value | number | The current value (controlled). | - |
valueLabel | ReactNode | The content to display as the value's label (e.g. 1 of 4). | - |
minValue | number | The smallest value allowed for the input. | 0 |
maxValue | number | The largest value allowed for the input. | 100 |
formatOptions | Intl.NumberFormat | The options to format the value. | {style: 'percent'} |
isIndeterminate | boolean | Whether the progress is indeterminate. | false |
isStriped | boolean | Whether the progress is striped. | false |
showValueLabel | boolean | Whether to show the value label. | true |
isDisabled | boolean | Whether the progress is disabled. | false |
disableAnimation | boolean | Whether to disable the animation. | false |
classNames | Record<"base"|"labelWrapper"|"label"|"track"|"value"|"track"|"indicator", string> | Allows to set custom class names for the progress slots. | - |