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>
<script setup lang="ts">
  import { MDBProgress, MDBProgressBar } from "mdb-vue-ui-kit";
</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>
<script setup lang="ts">
  import { MDBProgress, MDBProgressBar } from "mdb-vue-ui-kit";
</script>

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

<template>
  <MDBProgress>
    <MDBProgressBar :value="75" :min="0" :max="100" class="w-75" />
  </MDBProgress>
</template>
<script>
  import { MDBProgress, MDBProgressBar } from "mdb-vue-ui-kit";

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

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.

<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>
<script setup lang="ts">
  import { MDBProgress, MDBProgressBar } from "mdb-vue-ui-kit";
</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>
<script setup lang="ts">
  import { MDBProgress, MDBProgressBar } from "mdb-vue-ui-kit";
</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>
<script setup lang="ts">
  import { MDBProgress, MDBProgressBar } from "mdb-vue-ui-kit";
</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>
<script setup lang="ts">
  import { MDBProgress, MDBProgressBar } from "mdb-vue-ui-kit";
</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>
<script setup lang="ts">
  import { MDBProgress, MDBProgressBar } from "mdb-vue-ui-kit";
</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>
<script setup lang="ts">
  import { MDBProgress, MDBProgressBar } from "mdb-vue-ui-kit";
</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>

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.

// .progress
--#{$prefix}progress-height: #{$progress-height};
@include rfs($progress-font-size, --#{$prefix}progress-font-size);
--#{$prefix}progress-bg: #{$progress-bg};
--#{$prefix}progress-border-radius: #{$progress-border-radius};
--#{$prefix}progress-box-shadow: #{$progress-box-shadow};
--#{$prefix}progress-bar-color: #{$progress-bar-color};
--#{$prefix}progress-bar-bg: #{$progress-bar-bg};
--#{$prefix}progress-bar-transition: #{$progress-bar-transition};

SCSS variables

$progress-height: 4px;
$progress-font-size: $font-size-base * 0.75;
$progress-bg: $gray-200;
$progress-border-radius: $border-radius;
$progress-box-shadow: $box-shadow-inset;
$progress-bar-color: $white;
$progress-bar-bg: $primary;
$progress-bar-animation-timing: 1s linear infinite;
$progress-bar-transition: width 0.6s ease;