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
export const WithLabel: Story = {
args: {
value: 75,
label: 'Uploading files...',
showLabel: true,
},
};Colors
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
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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
value | number | No | Current progress value, clamped to | |
max | number | No | 100 | Maximum progress value. A |
label | string | No | Accessible name of the progress bar: | |
showLabel | boolean | No | Renders | |
color | 'brand' | 'success' | 'warning' | 'error' | No | 'brand' | Color of the fill. Inside a |
thickness | 'medium' | 'large' | No | 'medium' | Height of the track: |
shape | 'square' | 'rounded' | No | 'rounded' | Corners of the track and the fill: |
indeterminateMotion | MotionSlot | null | No | the sweep described above | Replaces the motion of the indeterminate fill (no |
ref | React.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 |
Any other prop is passed to the element it renders (HTMLDivElement).
Parts
barlabel
Stable class names
| Part | Class |
|---|---|
root | wave-progress-bar |
bar | wave-progress-bar__bar |
label | wave-progress-bar__label |