Progress
Use Progress and ProgressStack to display progress bars, including stacked bars, striped backgrounds, animation, and text labels.
How it works
Progress renders an accessible progress indicator and visual bar. It does not use the HTML <progress> element, which allows the component to support stacking, animation, and labels inside the bar.
Progressusesvalue,min, andmaxto set the current and range values, and generates the accessibility attributes automatically.- Provide an accessible name with
aria-labeloraria-labelledby. - Pass a label as
Progress's children. - Use
barPropsto pass styles or utility classes to the inner bar. - Use
ProgressStackto group multiple progress components into a stacked bar.
Put that all together, and you have the following examples.
Progress generates both elements and the value attributes from value, min, and max.
Provide an accessible name; pass labels as children and inner-bar utilities through barProps.
ProgressStack uses CSS to place each segment’s calculated width on its outer element.
<Stack gap={3}>
<Progress
aria-label="Basic example"
value={0}
/>
<Progress
aria-label="Basic example"
value={25}
/>
<Progress
aria-label="Basic example"
value={50}
/>
<Progress
aria-label="Basic example"
value={75}
/>
<Progress
aria-label="Basic example"
value={100}
/>
</Stack>Bar sizing
Width
Use width utilities through Progress's barProps.className when you need to adjust the visual bar width.
<Stack gap={3}>
<Progress
aria-label="Basic example"
barProps={{
className: 'w-75'
}}
value={75}
/>
</Stack>Height
Set the height on Progress itself; the inner bar resizes automatically.
<Stack gap={3}>
<Progress
aria-label="Example 1px high"
style={{
height: '1px'
}}
value={25}
/>
<Progress
aria-label="Example 20px high"
style={{
height: '20px'
}}
value={25}
/>
</Stack>Labels
Pass a label as children of Progress.
<Stack gap={3}>
<Progress
aria-label="Example with label"
value={25}
>
25%
</Progress>
</Stack>Long labels
By default, the content inside Progress is clipped to the bar. If the bar is shorter than its label, the content may become unreadable. To change this behavior, pass the overflow-visible utility through barProps.className.
Labels longer than the progress bar may not be fully accessible because their text color must contrast with both the track and bar backgrounds. Use caution when implementing this example.
If the text can overlap the progress bar, we often recommend displaying the label outside of the progress bar for better accessibility.
Backgrounds
Set theme on Progress to choose a theme color for its bar. For custom colors, pass a background utility through barProps.className.
<Stack gap={3}>
<Progress
aria-label="Success example"
barProps={{
className: 'bg-success'
}}
value={25}
/>
<Progress
aria-label="Info example"
barProps={{
className: 'bg-info'
}}
value={50}
/>
<Progress
aria-label="Warning example"
barProps={{
className: 'bg-warning'
}}
value={75}
/>
<Progress
aria-label="Danger example"
barProps={{
className: 'bg-danger'
}}
value={100}
/>
</Stack>Conveying meaning to assistive technologies: Color alone is not conveyed to screen reader users. Ensure that information is also clear from the content, or include it in the accessible name with
aria-labeloraria-labelledby.
If you’re adding labels to progress bars with a custom background color, make sure to also set an appropriate text color, so the labels remain readable and have sufficient contrast. We recommend using the theme contrast helper classes.
<Stack gap={3}>
<Progress
aria-label="Success example"
theme="success"
value={25}
>
25%
</Progress>
<Progress
aria-label="Info example"
theme="info"
value={50}
>
50%
</Progress>
<Progress
aria-label="Warning example"
theme="warning"
value={75}
>
75%
</Progress>
<Progress
aria-label="Danger example"
theme="danger"
value={100}
>
100%
</Progress>
</Stack>Multiple bars
Place multiple Progress components inside ProgressStack to create a single stacked bar. In this case, set each segment's value on Progress; do not set a separate width on its inner bar.
<Stack gap={3}>
<ProgressStack>
<Progress
aria-label="Segment one"
value={15}
/>
<Progress
aria-label="Segment two"
barProps={{
className: 'bg-success'
}}
value={30}
/>
<Progress
aria-label="Segment three"
barProps={{
className: 'bg-info'
}}
value={20}
/>
</ProgressStack>
</Stack>Striped
Set striped on Progress to apply a gradient stripe over the bar's background color.
<Stack gap={3}>
<Progress
aria-label="Default striped example"
striped
value={10}
/>
<Progress
aria-label="Success striped example"
barProps={{
className: 'bg-success'
}}
striped
value={25}
/>
<Progress
aria-label="Info striped example"
barProps={{
className: 'bg-info'
}}
striped
value={50}
/>
<Progress
aria-label="Warning striped example"
barProps={{
className: 'bg-warning'
}}
striped
value={75}
/>
<Progress
aria-label="Danger striped example"
barProps={{
className: 'bg-danger'
}}
striped
value={100}
/>
</Stack>Animated stripes
Set animated as well as striped on Progress to animate the stripes from right to left.
<Stack gap={3}>
<Progress
animated
aria-label="Animated striped example"
striped
value={75}
/>
</Stack>CSS
Variables
Customize the component with the following local CSS variables. Override them through the wrapper’s style prop or your own CSS module.
| CSS variable | Default |
|---|---|
--bs-progress-height | 1rem |
--bs-progress-font-size | var(--bs-font-size-sm) |
--bs-progress-bg | var(--bs-bg-2) |
--bs-progress-border-radius | var(--bs-radius-5) |
--bs-progress-box-shadow | var(--bs-box-shadow-inset) |
--bs-progress-bar-color | var(--bs-white) |
--bs-progress-bar-bg | var(--bs-primary-bg) |
--bs-progress-bar-transition | width 0.6s ease |
--bs-progress-bar-animation | progress-bar-stripes 1s linear infinite |
Keyframes
Used when the animated prop is enabled. The animation moves the striped background from one stripe
width to zero, producing continuous motion from right to left.