Progress bar
Progress bar base code
The base progress bar relies on a specific HTML structure and set of CSS classes to render correctly.
The example below outlines the two key elements required to create a basic progress bar. The .progress class acts as the wrapper and contains the .progress-bar.
The main outer wrapper .progress-container allows a label, note and helper text to be rendered with the progress bar. The .progress-header acts as the wrapper for the .progress-label and .progress-note.
<div class="progress-container">
<div class="progress-header">
<label for="Progress-bar-example" class="progress-label">Progress label</label>
</div>
<div id="Progress-bar-example" class="progress" role="progressbar" aria-label="Progress label" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
<div class="progress-bar" style="width: 50%"></div>
</div>
</div>
Indeterminate
To render an indeterminate progress bar add the .progress-bar-indeterminate class to the .progress.
<div class="progress-container">
<div class="progress-header">
<label for="Progress-indeterminate-example" class="progress-label">Progress indeterminate</label>
</div>
<div id="Progress-indeterminate-example" class="progress" role="progressbar" aria-label="Progress indeterminate">
<div class="progress-bar progress-bar-indeterminate"></div>
</div>
</div>
Helper text
To include helper text add a <small> with the class .progress-helper directly underneath the .progress inside the .progress-container.
<div class="progress-container">
<div class="progress-header">
<label for="Progress-help-example" class="progress-label">Progress helper text</label>
</div>
<div id="Progress-help-example" class="progress" role="progressbar" aria-label="Progress helper text" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">...</div>
<small class="progress-helper">Helper text</small>
</div>
Progress note
To include progress note text add a <span> with the class .progress-note directly underneath the .progress-label inside the .progress-header.
<div class="progress-container">
<div class="progress-header">
<label for="Progress-bar-example" class="progress-label">Progress label</label>
<span class="progress-note">Note</span>
</div>
<div id="Progress-bar-example" class="progress" role="progressbar" aria-label="Progress label" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">...</div>
</div>
Success
Add the .is-valid class to the .progress to give the progress bar its success status. This will add the success icon automatically in place of the .progress-note if one is present, as well as set the .progress-bar width to 100%.
<div class="progress-container">
<div class="progress-header">
<label for="Progress-bar-example" class="progress-label">Progress success</label>
</div>
<div id="Progress-bar-example" class="progress is-valid" role="progressbar" aria-label="Progress success" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
<div class="progress-bar" style="width: 100%"></div>
</div>
</div>
Error
Add the .is-invalid class to the .progress to give the progress bar its error status. This will add the error icon automatically in place of the .progress-note if one is present, as well as set the .progress-bar width to 100%.
The required .invalid-feedback will be displayed and will replace the helper text if present.
<div class="progress-container">
<div class="progress-header">
<label for="Progress-bar-example" class="progress-label">Progress error</label>
</div>
<div id="Progress-bar-example" class="progress is-invalid" role="progressbar" aria-label="Progress error" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
<div class="progress-bar" style="width: 100%"></div>
</div>
<div class="invalid-feedback">
Validation message
</div>
</div>
Expressive colours
To apply the expressive colour palette, add .expressive-* with the corresponding suffix that is associated with the required theme (secondary, tertiary or quaternary).
/* Secondary */
<div class="progress expressive-secondary"></div>
/* Tertiary */
<div class="progress expressive-tertiary"></div>
/* Quaternary */
<div class="progress expressive-quaternary"></div>