The progress module gives you full control over the presentation of progress and loading on your pages. Apart from progress bars and color variants for them, spinner elements are provided to help communicate that something is loading.
All examples showcased refer to the mini-default flavor, some class names and styles might differ based on the flavor you're using.
Progress indicators are very common UI elements for almost any website and web app, as they help communicate vital information such as the fact that a process is being executed in the background, informing the user that they should wait for it to complete before proceeding. The progress module provides you with two essential tools to communicate this information: the
<progress> HTML element, which is pre-styled and compatible with modern browsers to help you communicate information about the percentage of a task and the
.spinner-donut class that allows you to create an animated spinner that communicates that something is loading currently and will continue doing so for an indefinite amount of time. Both elements come with their own color and size variants and are fully accessible.
To use the progress module, simply include the link to the flavor you are using and start writing your HTML page as usual. One suggestion we will make is to add the following line inside your HTML page's
<head> to utilize the viewport meta tag:
<meta name="viewport" content="width=device-width, initial-scale=1">
Basic progress bar
Process is 0% complete!
Process is 45% complete!
Process is 100% complete!
To create a progress bar, use the
<progress> HTML element, specify the preset maximum of
max="1000" and set a
1000. Update your
value to any integer in the same range.
<progress value="0" max="1000"></progress> <progress value="450" max="1000"></progress> <progress value="1000" max="1000"></progress>
- We made sure that the
<progress>element displays properly on all modern browsers, using browser-specific rules. However, there might be some irregularities with older browsers, especially legacy versions of Internet Explorer.
- If the preset
max="1000"does not suit your needs, you should check the customization page for instructions on how to set your own maximum value for the
<progress value="80" max="100"></progress>
Don't: Avoid using different values for the
max, except for the preset one (
<progress value="450.5" max="1000.0"></progress>
Don't: Try not to use floating point values for either the
max. During testing of the module, we found that floating point values could cause unexpected behavior.
Progress bar variants
Secondary process is 60% complete!
Tertiary process is 30% complete!
Inline progress bar:
Apart from the default style for the
<progress> element, we have also included a couple of variants for it. As with many other elements, you can change the color of your progress bars, based on the context, using the
.tertiary class. You can also make a
<progress> element display inline, using the
<progress class="secondary" value="600" max="1000"></progress> <progress class="tertiary" value="300" max="1000"></progress> <progress class="inline" value="150" max="1000"></progress>
- If you want to add your own custom size classes for
<progress>elements, check the customization page for instructions.
<progress class="inline secondary" value="800" max="1000"></progress> <!-- or --> <progress class="inline tertiary" value="650" max="1000"></progress>
Do: You can mix size and color classes for
<progress> elements as needed.
<progress class="secondary teriary" value="450" max="1000"></progress>
Don't: Avoid mixing two classes of the same type (i.e. two color classes or two size classes).
Donut spinners can be used to indicate that something is loading or that a process is running in the background. To create a donut spinner, add the
.spinner-donut class to an element of your liking. We would recommend using a
<div> element for most cases, but
<span> elements should work pretty well, too.
.spinner-donutis an animated component, meaning that if a browsers does not support animation, this element might display incorrectly.
- In certain cases, it might be useful to add the
role="progressbar"attribute to increase donut spinner accessibility.
<p>Loading... <span class="spinner-donut"></span></p>
Do: You can place a
.spinner-donut inside a paragraph or some other textual context and it will display inline.
Don't: Avoid inserting text inside the
.spinner-donut, as this might cause unexpected bahavior and will probably make the text spin along with it.
Donut spinner variants
Apart from the default donut spinner style, there are also two more contextual color classes:
.tertiary. If your donut spinners are too small, you can also use the
.large class to make it pop out a little bit more.
<div class="spinner-donut secondary"></div> <div class="spinner-donut tertiary"></div> <div class="spinner-donut large"></div>
- You can mix one of the contextual color classes and the
.largeclass, if you want, similarly to what you can do with progress bars.
If you want to learn more about mini.css's modules, go back to the modules page and choose another module to see its documentation.