Progress
React Bootstrap 5 Progress component
Documentation and examples for using custom progress bars featuring support for stacked bars, animated backgrounds, and text labels.
Basic example
How it works
Progress components are built with two HTML elements, some CSS to set the width, and a few
attributes. We don’t use
the HTML5 <progress>
element, ensuring you can stack progress bars, animate them, and place text labels over them.
-
We use the
MDBProgress
as a wrapper to indicate the max value of the progress bar. - We use the inner
MDBProgressBar
to indicate the progress so far. - Widht of the
MDBProgressBar
can be set withvalue
prop. -
The
MDBProgressBar
has automatically addedrole
andaria
attributes to make it accessible.
Put that all together, and you have the following examples.
MDB provides a handful of utilities for setting width. Depending on your needs, these may help with quickly configuring progress.
Labels
Add labels to your progress bars by placing text within the
MDBProgress
.
To make the label visible you need to set a proper height to the bar.
Height
We only set a height
value on the MDBProgress
, so if you change that
value the inner MDBProgressBar
will automatically resize accordingly.
Colors
Use background utility classes to change the appearance of individual progress bars.
Multiple bars
Include multiple progress bars in a progress component if you need.
Striped
Add striped
to any MDBProgressBar
to apply a stripe via CSS gradient
over the progress bar’s background color.
Animated stripes
The striped gradient can also be animated. Add
animated
to MDBProgressBar
to animate the stripes right to left via
CSS3 animations.
Progress - API
Import
Properties
MDBProgress
Name | Type | Default | Description | Example |
---|---|---|---|---|
tag
|
String | 'div' |
Defines tag of the MDBProgress element |
<MDBProgress
tag="section"><MDBProgressBar/></MDBProgress>
|
height
|
Number | String |
|
Sets the height of the MDBProgress and
MDBProgressBar elements
|
<MDBProgress
:height="10"><MDBProgressBar/></MDBProgress>
|
MDBProgressBar
Name | Type | Default | Description | Example |
---|---|---|---|---|
tag
|
String | 'li' |
Defines tag of the MDBProgressBar element |
<MDBProgress><MDBProgressBar
tag="section"/></MDBProgress>
|
bgColor
|
String |
|
Sets background color of the
MDBProgressBar element.
|
<MDBProgress><MDBProgressBar
bgColor="success"/></MDBProgress>
|
striped
|
Boolean | false |
Adds striped effect |
<MDBProgress><MDBProgressBar
striped></MDBProgress>
|
animated
|
Boolean | false |
Adds animation effect |
<MDBProgress><MDBProgressBar
animated></MDBProgress>
|
valuenow
|
Number | 0 |
Changes progress value |
<MDBProgress><MDBProgressBar
valuenow="10"></MDBProgress>
|
valuemin
|
Number | 0 |
Changes minimum progress value |
<MDBProgress><MDBProgressBar
valuemin="10"></MDBProgress>
|
valuemax
|
Number | 100 |
Changes maximum progress value |
<MDBProgress><MDBProgressBar
valuemax="10"></MDBProgress>
|
width
|
Number | String | 100 |
Change width of MDBProgressBar element |
<MDBProgress><MDBProgressBar
valuemax="10"></MDBProgress>
|
CSS variables
As part of MDB’s evolving CSS variables approach, progress now use local CSS variables on .progress
for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.