Progress
Documentation and examples for using InPage custom progress bars featuring support for stacked bars, animated backgrounds, and text labels.
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
.progress
as a wrapper to indicate the max value of the progress bar. - We use the inner
.progress-bar_sth
to indicate the progress so far. - The
.progress-bar_sth
requires an inline style, utility class, or custom CSS to set their width. - The
.progress-bar_sth
also requires somerole
andaria
attributes to make it accessible.
Put that all together, and you have the following examples.
<div class="progress_sth">
<div class="progress-bar_sth" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress_sth">
<div class="progress-bar_sth" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress_sth">
<div class="progress-bar_sth" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress_sth">
<div class="progress-bar_sth" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress_sth">
<div class="progress-bar_sth" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
InPage provides a handful of utilities for setting width. Depending on your needs, these may help with quickly configuring progress.
<div class="progress_sth">
<div class="progress-bar_sth w-75_sth" 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 .progress-bar_sth
.
<div class="progress_sth">
<div class="progress-bar_sth" role="progressbar" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">25%</div>
</div>
Height
We only set a height
value on the .progress_sth
, so if you change that value the inner .progress-bar_sth
will automatically resize accordingly.
<div class="progress_sth" style="height: 1px;">
<div class="progress-bar_sth" role="progressbar" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress_sth" style="height: 20px;">
<div class="progress-bar_sth" role="progressbar" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Backgrounds
Use background utility classes to change the appearance of individual progress bars.
<div class="progress_sth">
<div class="progress-bar_sth bg-success_sth" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress_sth">
<div class="progress-bar_sth bg-info_sth" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress_sth">
<div class="progress-bar_sth bg-warning_sth" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress_sth">
<div class="progress-bar_sth bg-danger_sth" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Multiple bars
Include multiple progress bars in a progress component if you need.
<div class="progress_sth">
<div class="progress-bar_sth" role="progressbar" style="width: 15%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar_sth bg-success_sth" role="progressbar" style="width: 30%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar_sth bg-info_sth" role="progressbar" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Striped
Add .progress-bar-striped_sth
to any .progress-bar_sth
to apply a stripe via CSS gradient over the progress bar’s background color.
<div class="progress_sth">
<div class="progress-bar_sth progress-bar-striped_sth" role="progressbar" style="width: 10%" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress_sth">
<div class="progress-bar_sth progress-bar-striped_sth bg-success_sth" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress_sth">
<div class="progress-bar_sth progress-bar-striped_sth bg-info_sth" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress_sth">
<div class="progress-bar_sth progress-bar-striped_sth bg-warning_sth" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress_sth">
<div class="progress-bar_sth progress-bar-striped_sth bg-danger_sth" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Animated stripes
The striped gradient can also be animated. Add .progress-bar-animated_sth
to .progress-bar_sth
to animate the stripes right to left via CSS3 animations.
Animated progress bars don’t work in Opera 12—as they don’t support CSS3 animations.
<div class="progress_sth">
<div class="progress-bar_sth progress-bar-striped_sth progress-bar-animated_sth" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"></div>
</div>