Surfaces and display
Progress and meter
How far a task has come, and where a value lies in a range. A <progress class="kui-progress__bar"> for work under way, .kui-ring for a round one, and <meter class="kui-meter"> for a level that is not progress.
Examples
A bar with its name and value
<div class="kui-progress">
<div class="kui-progress__head"><span id="progress-upload">Uploading 14 documents</span><span>9 of 14</span></div>
<progress class="kui-progress__bar" aria-labelledby="progress-upload" max="14" value="9"></progress>
</div>
<div class="kui-progress kui-progress--ok">
<div class="kui-progress__head"><span id="progress-profile">Profil kancelarije</span><span>100 %</span></div>
<progress class="kui-progress__bar" aria-labelledby="progress-profile" max="100" value="100"></progress>
</div>
Indeterminate
Without a value the bar sweeps: the work has started and its length is not known.
<div class="kui-progress">
<div class="kui-progress__head"><span id="progress-sync">Syncing with eFaktura</span><span></span></div>
<progress class="kui-progress__bar" aria-labelledby="progress-sync"></progress>
</div>
Rings
.kui-ring with role="progressbar", the value in aria-valuenow and in the custom property --kui-value.
<div class="kui-ring" role="progressbar" aria-label="Tax return filled in" aria-valuenow="72" aria-valuemin="0" aria-valuemax="100" style="--kui-value: 72"><span>72 %</span></div>
<div class="kui-ring kui-ring--lg" role="progressbar" aria-label="Year’s billing goal" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="--kui-value: 45"><span>45 %</span></div>
<div class="kui-ring kui-ring--sm" role="progressbar" aria-label="Steps done" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" style="--kui-value: 30"><span>30 %</span></div>
Meters
A meter colours itself by its low, high and optimum: green in the good range, amber in between, red in the bad one.
<div class="kui-progress">
<div class="kui-progress__head"><label for="progress-storage">Storage used</label><span>3,1 of 10 GB</span></div>
<meter class="kui-meter" id="progress-storage" min="0" max="10" low="7" high="9" optimum="2" value="3.1">3,1 GB</meter>
</div>
<div class="kui-progress">
<div class="kui-progress__head"><label for="progress-pw">Password strength</label><span>Weak</span></div>
<meter class="kui-meter" id="progress-pw" min="0" max="4" low="2" high="3" optimum="4" value="1">Weak</meter>
</div>
States
Every state
Empty: value 0, the track only. Done: the full bar, green with --ok. Failed: the bar stops and turns red with --danger, with words that say what happened. With reduced motion asked for, the indeterminate sweep does not move.
<div class="kui-progress"><div class="kui-progress__head"><span id="progress-s0">Not started</span><span>0 %</span></div><progress class="kui-progress__bar" aria-labelledby="progress-s0" max="100" value="0"></progress></div>
<div class="kui-progress kui-progress--danger"><div class="kui-progress__head"><span id="progress-s1">Upload stopped: the connection was lost</span><span>38 %</span></div><progress class="kui-progress__bar" aria-labelledby="progress-s1" max="100" value="38"></progress></div>
Classes and attributes
.kui-progress- A column: the head with the name and the value, then the bar or meter.
.kui-progress__head- The name (first child) and the value (last child).
progress.kui-progress__bar- The bar. max and value; no value for indeterminate.
--ok, --danger- On .kui-progress: green or red bar.
.kui-ring- A ring: role="progressbar", aria-valuenow, and style="--kui-value: N". --sm hides the number, --lg is larger.
meter.kui-meter- A level in a range: min, max, low, high, optimum, value.
Accessibility
- A native progress and meter are read with their value; tie them to their name with aria-labelledby or a label.
- The ring is role="progressbar" with aria-valuenow and a name.
- Do not announce every step of a bar; announce the start, the end and a failure.
- A meter is not progress: use it for a level, such as storage or strength, never for a task.
Do and do not
Do
- Show a number next to the bar when it is known.
- Say what is happening in the name: “Uploading 14 documents”.
- Use the indeterminate bar only until the length is known.
Do not
- Do not show a progress bar for work under a second.
- Do not let a bar go backwards.
- Do not use a meter for progress.