Skip to content

ProgressBar

ProgressBar

Shows the progress of a task, or that a task is running (indeterminate, value omitted).

- Name it with label (or aria-label / aria-labelledby); showLabel shows the label above the bar.
- value is clamped to 0…max; invalid numbers render an empty bar and warn in development.
- color picks the fill (brand, success, warning, error); thickness the track's height (medium 8px, large 12px) and shape its corners (rounded or square).
- Inside a Field, the Field's label names a bar that has no name of its own, its validation message and hint describe the bar, and its validation state (error, warning, success) colors the fill unless color is set. A progress bar is never invalid or required: the aria-invalid and aria-required a Field adds are not rendered. Next to another control in a Field's wrapper element, the bar gets an id of its own and leaves the Field's <label htmlFor> to that control.
- The indeterminate animation follows the writing direction and becomes a full-width pulse for reduced motion; indeterminateMotion replaces or removes it. In forced-colors mode the fill uses Highlight and the track gets a border.

Examples

Default

export const Default: Story = {
  args: {
    value: 60,
  },
};

Indeterminate

export const Indeterminate: Story = {
  args: {
    label: 'Syncing',
  },
};

With Label

Uploading files...
export const WithLabel: Story = {
  args: {
    value: 75,
    label: 'Uploading files...',
    showLabel: true,
  },
};

Colors

Brand
Success
Warning
Error
export const Colors: Story = {
  args: {
    value: 60,
    showLabel: true,
  },
  render: ({ color: _color, label: _label, ...args }) => (
    <div className="flex w-80 flex-col gap-4">
      {colors.map(([color, label]) => (
        <ProgressBar key={color} {...args} color={color} label={label} />
      ))}
    </div>
  ),
};

In Field

3 of 12 files uploaded.

Your plan includes 10 GB.

export const InField: Story = {
  args: {
    value: 40,
  },
  render: ({ label: _label, ...args }) => (
    <div className="flex w-80 flex-col gap-6">
      <Field label="Uploading photos" hint="3 of 12 files uploaded.">
        <ProgressBar {...args} />
      </Field>
      <Field
        label="Storage"
        hint="Your plan includes 10 GB."
        validationState="warning"
        validationMessage="Almost full: 9.2 GB used."
      >
        <ProgressBar {...args} value={92} />
      </Field>
      <Field
        label="Backing up"
        error="The connection was lost. The backup continues when you are online."
      >
        <ProgressBar {...args} value={70} />
      </Field>
    </div>
  ),
};

Motion

export const Motion: Story = {
  render: ({ label: _label, value: _value, ...args }) => (
    <div className="flex w-80 flex-col gap-4">
      {motionCases(quarterSweep).map(({ label, motion }) => (
        <ProgressBar key={label} {...args} label={label} indeterminateMotion={motion} />
      ))}
    </div>
  ),
};

Thickness And Shape

Medium, rounded
Large, rounded
Medium, square
Large, square
export const ThicknessAndShape: Story = {
  args: {
    value: 60,
    showLabel: true,
  },
  render: ({ thickness: _thickness, shape: _shape, label: _label, ...args }) => (
    <div className="flex w-80 flex-col gap-4">
      <ProgressBar {...args} label="Medium, rounded" />
      <ProgressBar {...args} label="Large, rounded" thickness="large" />
      <ProgressBar {...args} label="Medium, square" shape="square" />
      <ProgressBar {...args} label="Large, square" thickness="large" shape="square" />
    </div>
  ),
};

Props

NameTypeRequiredDefaultDescription
valuenumberNo

Current progress value, clamped to 0…max for both the fill and aria-valuenow. Omit for indeterminate mode. A non-finite value renders 0% (development warning).

maxnumberNo100

Maximum progress value. A max of 0 or less, or a non-finite max, renders 0% (development warning) and is reported to assistive technology as 0 of 100.

labelstringNo

Accessible name of the progress bar: aria-label by default, or a visible label with showLabel. A progress bar needs a name (label, aria-label or aria-labelledby); a development warning fires without one. A consumer aria-label or aria-labelledby takes precedence over label; an empty or whitespace-only one counts as absent (it is not rendered). Inside a Field, the Field's label names the bar when neither label nor a consumer name is given.

showLabelbooleanNo

Renders label as visible text above the bar and names the bar with it (aria-labelledby) instead of aria-label, unless a consumer aria-label or aria-labelledby names the bar (keep the visible text in that name, WCAG 2.5.3). The label and the bar are then wrapped in a div; ref, className, style and the other props stay on the progress bar element.

color'brand' | 'success' | 'warning' | 'error'No'brand'

Color of the fill. Inside a Field it follows the Field's validation state (error, warning, success) unless you set it. warning fills with the dark orange of the severe color, which keeps 3:1 against the track in every theme. The bar carries data-color with the resolved color.

thickness'medium' | 'large'No'medium'

Height of the track: medium (8px) or large (12px). WaveUI's medium is the 8px bar of 0.x, thicker than Fluent's 2px medium (and its 4px large), so an app that wants Fluent's thin bar sets a className height. The bar carries data-thickness with the resolved value. Fluent's thickness.

shape'square' | 'rounded'No'rounded'

Corners of the track and the fill: rounded (fully rounded ends) or square (none), for a bar that spans an edge. The bar carries data-shape with the resolved value. Fluent's shape.

indeterminateMotionMotionSlot | nullNothe sweep described above

Replaces the motion of the indeterminate fill (no value): by default a fill two fifths of the track wide sweeps across it, mirrored in right-to-left, and becomes a full-width pulse for reduced motion. The classes go on the fill and replace the whole default, its width and its reduced-motion counterparts included. null draws a static full-width fill; a class string or { className } replaces the classes with plain animation classes (and a width) and their reduced-motion counterparts (the fill has no presence phases). A WaveProvider with motion="none" turns the default off (a static full-width fill), and a value here still applies under it. A determinate bar has no motion and ignores it. Fluent's ProgressBar indeterminateMotion takes a motion slot the same way.

refReact.Ref<HTMLDivElement>No
slotProps{ bar?: SlotPart<'div'>; label?: SlotPart<'span'> }No

Props for the elements the progress bar draws besides its root, by part, merged into each part's own (Fluent UI's bar slot props; Fluent's label is a Field's): your classes after the part's (yours win a conflict), your styles over its styles, your attributes and handlers added, your ids added to its aria-labelledby and aria-describedby, and your ref beside its ref. Every attribute the progress bar sets on a part is locked and keeps its value; you add the attributes it does not set. A part takes no children. The root, the element with role="progressbar", takes the component's own props.

Any other prop is passed to the element it renders (HTMLDivElement).

Parts

  • bar
  • label

Stable class names

PartClass
rootwave-progress-bar
barwave-progress-bar__bar
labelwave-progress-bar__label