Progress

Vue Bootstrap 5 Progress component

Documentation and examples for using custom progress bars featuring support for stacked bars, animated backgrounds, and text labels.


Basic example


          <template>
            <MDBProgress>
              <MDBProgressBar :value="75" />
            </MDBProgress>
          </template>
        

          <script>
            import { MDBProgress, MDBProgressbar } from "mdb-vue-ui-kit";
  
            export default {
              components: {
                MDBProgress,
                MDBProgressBar
              }
            };
          </script>
        

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 with value prop.
  • The MDBProgressBar has automatically added role and aria attributes to make it accessible.

Put that all together, and you have the following examples.






          <template>
            <MDBProgress>
              <MDBProgressBar :value="0" />
            </MDBProgress>
            <br />
            <MDBProgress>
              <MDBProgressBar :value="25" />
            </MDBProgress>
            <br />
            <MDBProgress>
              <MDBProgressBar :value="50" />
            </MDBProgress>
            <br />
            <MDBProgress>
              <MDBProgressBar :value="75" />
            </MDBProgress>
            <br />
            <MDBProgress>
              <MDBProgressBar :value="100" />
            </MDBProgress>
          </template>
        

          <script>
            import { MDBProgress, MDBProgressbar } from "mdb-vue-ui-kit";
  
            export default {
              components: {
                MDBProgress,
                MDBProgressBar
              }
            };
          </script>
        

MDB provides a handful of utilities for setting width. Depending on your needs, these may help with quickly configuring progress.


          <div class="progress">
            <div
              class="progress-bar w-75"
              role="progressbar"
              aria-valuenow="75"
              aria-valuemin="0"
              aria-valuemax="100"
            ></div>
          </div>
        

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.

25%

          <template>
            <MDBProgress :height="20">
              <MDBProgressBar :value="25" >
                  25%
              </MDBProgressBar>
            </MDBProgress>
          </template>
        

          <script>
            import { MDBProgress, MDBProgressbar } from "mdb-vue-ui-kit";
  
            export default {
              components: {
                MDBProgress,
                MDBProgressBar
              }
            };
          </script>
        

Height

We only set a height value on the MDBProgress, so if you change that value the inner MDBProgressBar will automatically resize accordingly.



          <template>
            <MDBProgress>
              <MDBProgressBar :value="25" :style="1" />
            </MDBProgress>
  
            <MDBProgress :height="20">
              <MDBProgressBar :value="25" />
            </MDBProgress>
          </template>
        

          <script>
            import { MDBProgress, MDBProgressbar } from "mdb-vue-ui-kit";
  
            export default {
              components: {
                MDBProgress,
                MDBProgressBar
              }
            };
          </script>
        

Colors

Use background utility classes to change the appearance of individual progress bars.





          <template>
            <MDBProgress>
              <MDBProgressBar :value="25" bg="success" />
            </MDBProgress>
  
            <br />
  
            <MDBProgress>
              <MDBProgressBar :value="50" bg="info" />
            </MDBProgress>
  
            <br />
  
            <MDBProgress>
              <MDBProgressBar :value="75" bg="warning" />
            </MDBProgress>
  
            <br />
  
            <MDBProgress>
              <MDBProgressBar :value="100" bg="danger" />
            </MDBProgress>
          </template>
        

          <script>
            import { MDBProgress, MDBProgressbar } from "mdb-vue-ui-kit";
  
            export default {
              components: {
                MDBProgress,
                MDBProgressBar
              }
            };
          </script>
        

Multiple bars

Include multiple progress bars in a progress component if you need.


          <template>
            <MDBProgress>
              <MDBProgressBar :value="15" />
              <MDBProgressBar :value="30" bg="success" />
              <MDBProgressBar :value="20" bg="info" />
            </MDBProgress>
          </template>
        

          <script>
            import { MDBProgress, MDBProgressbar } from "mdb-vue-ui-kit";
  
            export default {
              components: {
                MDBProgress,
                MDBProgressBar
              }
            };
          </script>
        

Striped

Add striped to any MDBProgressBar to apply a stripe via CSS gradient over the progress bar’s background color.






          <template>
            <MDBProgress :height="20">
              <MDBProgressBar :value="10" striped />
            </MDBProgress>
            <MDBProgress :height="20">
              <MDBProgressBar :value="25" striped bg="success" />
            </MDBProgress>
            <MDBProgress :height="20">
              <MDBProgressBar :value="50" striped bg="info" />
            </MDBProgress>
            <MDBProgress :height="20">
              <MDBProgressBar :value="75" striped bg="warning" />
            </MDBProgress>
            <MDBProgress :height="20">
              <MDBProgressBar :value="100" striped bg="danger" />
            </MDBProgress>
          </template>
        

          <script>
            import { MDBProgress, MDBProgressbar } from "mdb-vue-ui-kit";
  
            export default {
              components: {
                MDBProgress,
                MDBProgressBar
              }
            };
          </script>
        

Animated stripes

The striped gradient can also be animated. Add animated to MDBProgressBar to animate the stripes right to left via CSS3 animations.


          <template>
            <MDBProgress :height="20">
              <MDBProgressBar :value="75" striped animated />
            </MDBProgress>
          </template>
        

          <script>
            import { MDBProgress, MDBProgressbar } from "mdb-vue-ui-kit";
  
            export default {
              components: {
                MDBProgress,
                MDBProgressBar
              }
            };
          </script>
        

Progress - API


Import


        <script>
          import { 
            MDBProgress,
            MDBProgressBar
          } from 'mdb-vue-ui-kit';
        </script>
      

Properties

MDBProgress

Name Type Default Description Example
tag String 'div' Defines tag of the MDBProgress element <MDBProgress tag="section"><MDBProgressBar/></MDBProgress>
height Number 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>
bg String Sets background color of the MDBProgressBar element. <MDBProgress><MDBProgressBar bg="success"/></MDBProgress>
striped Boolean false Adds striped effect <MDBProgress><MDBProgressBar striped></MDBProgress>
animated Boolean false Adds animation effect <MDBProgress><MDBProgressBar animated></MDBProgress>
value Number 0 Changes progress value <MDBProgress><MDBProgressBar :value="10"></MDBProgress>
min Number 0 Changes minimum progress value <MDBProgress><MDBProgressBar :min="10"></MDBProgress>
max Number 100 Changes maximum progress value <MDBProgress><MDBProgressBar :max="10"></MDBProgress>