Progress

The Progress component displays the status of a task or operation over time.

Give FeedbackWAI-ARIABundle Size
Uploading files

Installation

Base UI components are all available as a single package.

npm install @base-ui-components/react

Once you have the package installed, import the component.

import { Progress } from '@base-ui-components/react/progress';

Anatomy

Progress

<Progress.Root>
  <Progress.Track>
    <Progress.Indicator />
  </Progress.Track>
</Progress.Root>

Value

Determinate

The value prop represents the percentage value of the Progress component. The default minimum and maximum values are 0 and 100, and can be changed with the min and max props. When progress is determinate the data-progressing attribute exists, changing to data-complete when value equals max.

function App() {
  const [progressValue] = React.useState(25);
  return (
    <Progress.Root value={progressValue} min={0} max={100}>
      <Progress.Track>
        <Progress.Indicator />
      </Progress.Track>
    </Progress.Root>
  );
}

Indeterminate

Set value to null to configure an indeterminate progress bar. The data-indeterminate attribute will exist.

<Progress.Root value={null}>
  <Progress.Track>
    <Progress.Indicator />
  </Progress.Track>
</Progress.Root>
Uploading files

RTL

Place the component inside an HTML element or component with the HTML dir="rtl" attribute to change the direction that the Indicator fills towards for right-to-left languages:

<html dir="rtl">
  <body>
    <Progress.Root>
      <Progress.Track>
        <Progress.Indicator /> {/* fills from right to left */}
      </Progress.Track>
    <Progress.Root/>
  </body>
</html>
تحميل الملفات (RTL)

Overriding default components

Use the render prop to override the rendered element for all subcomponents:

<Progress.Indicator render={<MyCustomIndicator />} />
// or
<Progress.Indicator render={(props) => <MyCustomIndicator {...props} />} />

Accessibility

The Progress component implements the ARIA progressbar specification.

When using Progress, ensure that it has a human-readable text label by using either the aria-label, aria-labelledby, or getAriaLabel prop:

<Progress.Root aria-labelledby="MyCustomLabel">
  <MyCustomLabel id="MyCustomLabel">Loading progress<MyCustomLabel/>
  <Progress.Track>
    <Progress.Indicator />
  </Progress.Track>
</Progress.Root>

// or

<Progress.Root aria-label="Loading progress">
  <Progress.Track>
    <Progress.Indicator />
  </Progress.Track>
</Progress.Root>

API Reference

ProgressRoot

PropTypeDefaultDescription
aria-labelstringThe label for the Indicator component.
aria-labelledbystringAn id or space-separated list of ids of elements that label the Indicator component.
aria-valuetextstringA string value that provides a human-readable text alternative for the current value of the progress indicator.
classNameunionClass names applied to the element or a function that returns them based on the component's state.
getAriaLabelfuncAccepts a function which returns a string value that provides an accessible name for the Indicator component
getAriaValueTextfuncAccepts a function which returns a string value that provides a human-readable text alternative for the current value of the progress indicator.
maxnumber100The maximum value
minnumber0The minimum value
renderunionA function to customize rendering of the component.
valuenumbernullThe current value. The component is indeterminate when value is null.

ProgressTrack

PropTypeDefaultDescription
classNameunionClass names applied to the element or a function that returns them based on the component's state.
renderunionA function to customize rendering of the component.

ProgressIndicator

PropTypeDefaultDescription
classNameunionClass names applied to the element or a function that returns them based on the component's state.
renderunionA function to customize rendering of the component.

Contents