Progress - Linear
An element that shows either determinate or indeterminate progress.
Anatomy
<Progress.Root>
<Progress.Label />
<Progress.ValueText />
<Progress.Track>
<Progress.Range />
</Progress.Track>
</Progress.Root>
Examples
Min and Max
Set min and max to change the range. The default max is 100. This example shows progress from 10 to 30.
Indeterminate
Progress is determinate by default, with value 50 and max 100. Set value to null for indeterminate progress.
Value Text
Only sighted users can read a progress bar. Set the value key in translations to give screen readers a text
description.
Orientation
Set orientation="vertical" for a vertical progress.
Give the vertical progress a height in your styles.
Root Provider
Use RootProvider with the useProgress hook to access the state and methods from outside the component.
API Reference
Root
Defines the <div> element.
| Attribute | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`. For more details, read our Composition guide. | |
defaultValue | min | numberThe initial value of the progress bar when rendered. Use when you don't need to control the value of the progress bar. |
formatOptions | { style: 'percent' } | NumberFormatOptionsThe options to use for formatting the value. |
id | stringThe unique identifier of the machine. | |
ids | ElementIdsThe ids of the elements in the progress bar. Useful for composition. | |
locale | 'en-US' | stringThe locale to use for formatting the value. |
max | 100 | numberThe maximum allowed value of the progress bar. |
min | 0 | numberThe minimum allowed value of the progress bar. |
onValueChange | (details: ValueChangeDetails) => voidCallback fired when the value changes. | |
orientation | 'horizontal' | 'horizontal' | 'vertical'The orientation of the element. |
render | ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state. | |
translations | IntlTranslationsThe localized messages to use. | |
value | numberThe controlled value of the progress bar. |
| Attribute | Description |
|---|---|
[data-progress-root] | <uid> |
[data-max] | |
[data-value] | The value of the item |
[data-state] | "indeterminate" | "loading" | "complete" |
[data-orientation] | The orientation of the progress |
| CSS Variable | Description |
|---|---|
--percent | The percent value for the root |
--radius | The border radius value |
--circumference | The circumference value for the root |
--offset | The offset position of the element |
Circle
Defines the <svg> element.
| Attribute | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`. For more details, read our Composition guide. | |
render | ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state. |
| Attribute | Description |
|---|---|
[data-progress-circle] | <uid> |
[data-max] | |
[data-orientation] | The orientation of the circle |
[data-state] | "indeterminate" | "loading" | "complete" |
CircleRange
Defines the <circle> element.
| Attribute | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`. For more details, read our Composition guide. | |
render | ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state. |
| Attribute | Description |
|---|---|
[data-progress-circle-range] | <uid> |
[data-state] | "indeterminate" | "loading" | "complete" |
CircleTrack
Defines the <circle> element.
| Attribute | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`. For more details, read our Composition guide. | |
render | ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state. |
| Attribute | Description |
|---|---|
[data-progress-circle-track] | <uid> |
[data-orientation] | The orientation of the circletrack |
Label
Defines the <span> element.
| Attribute | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`. For more details, read our Composition guide. | |
render | ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state. |
| Attribute | Description |
|---|---|
[data-progress-label] | <uid> |
[data-orientation] | The orientation of the label |
Range
Defines the <div> element.
| Attribute | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`. For more details, read our Composition guide. | |
render | ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state. |
| Attribute | Description |
|---|---|
[data-progress-range] | <uid> |
[data-orientation] | The orientation of the range |
[data-state] | "indeterminate" | "loading" | "complete" |
RootProvider
Defines the <div> element.
| Attribute | Default | Type |
|---|---|---|
value | UseProgressReturn | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`. For more details, read our Composition guide. | |
render | ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state. |
Track
Defines the <div> element.
| Attribute | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`. For more details, read our Composition guide. | |
render | ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state. |
| Attribute | Description |
|---|---|
[data-progress-track] | <uid> |
[data-max] | |
[data-orientation] | The orientation of the track |
[data-state] | "indeterminate" | "loading" | "complete" |
ValueText
Defines the <span> element.
| Attribute | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`. For more details, read our Composition guide. | |
render | ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state. |
View
Defines the <span> element.
| Attribute | Default | Type |
|---|---|---|
state | ProgressState | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`. For more details, read our Composition guide. | |
render | ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<ProgressViewState>Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state. |
| Attribute | Description |
|---|---|
[data-progress-view] | <uid> |
[data-state] | "indeterminate" | "loading" | "complete" |
Accessibility
Complies with the progressbar role requirements.