Vue Progress Component
Documentation and examples for using Vue progress bars featuring support for stacked bars, animated backgrounds, and text labels.
Other frameworks
CoreUI components are available as native Angular, Bootstrap (Vanilla JS), and React components. To learn more please visit the following pages.
Example
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.
Basic usage
<CProgress class="mb-3">
<CProgressBar :value="0"/>
</CProgress>
<CProgress class="mb-3">
<CProgressBar :value="25"/>
</CProgress>
<CProgress class="mb-3">
<CProgressBar :value="50"/>
</CProgress>
<CProgress class="mb-3">
<CProgressBar :value="75"/>
</CProgress>
<CProgress class="mb-3">
<CProgressBar :value="100"/>
</CProgress>
Labels
Add labels to your progress bars by placing text within the <CProgressBar>
.
<CProgress class="mb-3">
<CProgressBar :value="25">25%</CProgressBar>
</CProgress>
Height
We only set a height
value on the <CProgress>
, so if you change that value the inner <CProgressBar>
will automatically resize accordingly.
<CProgress :height="1" class="mb-3">
<CProgressBar :value="25"></CProgressBar>
</CProgress>
<CProgress :height="20" class="mb-3">
<CProgressBar :value="25"></CProgressBar>
</CProgress>
Backgrounds
Use color
prop to change the appearance of individual progress bars.
<CProgress class="mb-3">
<CProgressBar color="success" :value="25"/>
</CProgress>
<CProgress class="mb-3">
<CProgressBar color="info" :value="50"/>
</CProgress>
<CProgress class="mb-3">
<CProgressBar color="warning" :value="75"/>
</CProgress>
<CProgress class="mb-3">
<CProgressBar color="danger" :value="100"/>
</CProgress>
Multiple bars
Include multiple progress bars in a progress component if you need.
<CProgress class="mb-3">
<CProgressBar :value="15"/>
<CProgressBar color="success" :value="30"/>
<CProgressBar color="info" :value="20"/>
</CProgress>
Striped
Add variant="striped"
to any <CProgressBar>
to apply a stripe via CSS gradient over the progress bar's background color.
<CProgress class="mb-3">
<CProgressBar color="success" variant="striped" :value="25"/>
</CProgress>
<CProgress class="mb-3">
<CProgressBar color="info" variant="striped" :value="50"/>
</CProgress>
<CProgress class="mb-3">
<CProgressBar color="warning" variant="striped" :value="75"/>
</CProgress>
<CProgress class="mb-3">
<CProgressBar color="danger" variant="striped" :value="100"/>
</CProgress>
Animated stripes
The striped gradient can also be animated. Add animated
property to <CProgressBar>
to animate the stripes right to left via CSS3 animations.
<CProgress class="mb-3">
<CProgressBar color="success" variant="striped" animated :value="25"/>
</CProgress>
<CProgress class="mb-3">
<CProgressBar color="info" variant="striped" animated :value="50"/>
</CProgress>
<CProgress class="mb-3">
<CProgressBar color="warning" variant="striped" animated :value="75"/>
</CProgress>
<CProgress class="mb-3">
<CProgressBar color="danger" variant="striped" animated :value="100"/>
</CProgress>
Customizing
CSS variables
Vue cards use local CSS variables on .card
for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.
--cui-progress-height: #{$progress-height};
--cui-progress-font-size: #{$progress-font-size};
--cui-progress-bg: #{$progress-bg};
--cui-progress-border-radius: #{$progress-border-radius};
--cui-progress-box-shadow: #{$progress-box-shadow};
--cui-progress-bar-color: #{$progress-bar-color};
--cui-progress-bar-bg: #{$progress-bar-bg};
--cui-progress-bar-transition: #{$progress-bar-transition};
How to use CSS variables
const vars = {
'--my-css-var': 10,
'--my-another-css-var': "red"
}
return <CProgress :style="vars">...</CProgress>
SASS variables
$progress-height: 1rem;
$progress-font-size: $font-size-base * .75;
$progress-bg: $gray-200;
$progress-border-radius: $border-radius;
$progress-box-shadow: $box-shadow-inset;
$progress-bar-color: $high-emphasis-inverse;
$progress-bar-bg: $primary;
$progress-bar-animation-timing: 1s linear infinite;
$progress-bar-transition: width .6s ease;
$progress-group-margin-bottom: $spacer;
$progress-group-header-margin-bottom: $spacer * .25;
API
CProgress
import { CProgress } from '@coreui/vue'
// or
import CProgress from '@coreui/vue/src/components/progress/CProgress'
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
height | Sets the height of the component. If you set that value the inner <CProgressBar> will automatically resize accordingly. | number | - | - |
thin | Makes progress bar thinner. | boolean | - | - |
white | Change the default color to white. | boolean | - | - |
CProgressBar
import { CProgressBar } from '@coreui/vue'
// or
import CProgressBar from '@coreui/vue/src/components/progress/CProgressBar'
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
animated | Use to animate the stripes right to left via CSS3 animations. | boolean | - | - |
color | Sets the color context of the component to one of CoreUI’s themed colors. | string | 'primary' , 'secondary' , 'success' , 'danger' , 'warning' , 'info' , 'dark' , 'light' | - |
value | The percent to progress the ProgressBar. | number | - | 0 |
variant | Set the progress bar variant to optional striped. | string | 'striped' | - |