Skip to content
Tutorials Center
My learning

Topics

React Reference ยท Built-in DOM Components

The React progress element

Reference for the React progress element: show determinate progress with value and max, go indeterminate by omitting value, and label it for screen readers.

<progress> is the native progress bar. With a value, it shows how far along a task is. Without a value, it is indeterminate: the browser shows a moving or striped bar meaning "working, no idea how long". Browsers draw it for you, support keyboard and screen-reader semantics, and let you restyle it with CSS (using vendor pseudo-elements).

React treats <progress> like any other element, but there is one practical detail: value is a plain attribute, not an input-like controlled prop. Pass a number from state and React updates the bar when it changes. No onChange is needed because the user cannot edit it.

JSX
<progress value={30} max={100} aria-label="Upload progress" />

Try it

Determinate progress from state
Switching between indeterminate and determinate

Syntax

JSX
<progress value={number} max={number} />
Name Description
value Current progress, between 0 and max. Omit it (pass undefined) for an indeterminate bar.
max The value that means "complete". Default is 1. Must be greater than 0.
children Fallback text for very old browsers. Modern browsers ignore it, but it is harmless and can be a nice text label.

Returns: an HTMLProgressElement. Its position property is value / max for a determinate bar and -1 for an indeterminate one.

Edge cases: a value above max is clamped to max by the DOM. undefined and null both leave out the attribute, so the bar is indeterminate.

Usage notes

  • Default max is 1. value={0.3} is 30 percent. If you use percentages, set max={100} so value={30} means 30 percent.
  • Indeterminate means no value attribute. Setting value={0} shows an empty bar, not a spinner.
  • Label it. A bar without a name is not useful to assistive technology. Use aria-label, aria-labelledby, or wrap it in a <label>.
  • Do not confuse with <meter>. <progress> is for a task moving toward completion. <meter> is a gauge for a known range (disk usage, a score).
  • Announce changes sparingly. Progress bars are not live regions. For long tasks, also update a text status with role="status", and do not update it on every percent.
  • Styling. Browser-specific selectors (::-webkit-progress-bar, ::-webkit-progress-value, ::-moz-progress-bar) change the look. Set appearance: none first. Check each browser.
  • Smooth animation. Updating value in small steps looks jumpy. A CSS transition is not applied consistently to native progress bars, so for animated effects some teams use a div with role="progressbar" and aria-valuenow.
  • Updates are cheap. Changing value touches one attribute, but state at a high frequency (many times per second) re-renders the component, so throttle upload events.