Forms
Progress
Shows people how far through a task they are, such as “Question 3 of 4”, in words and as a bar.
When to use
- On each question page of a service with 3 or more pages, so people know how much is left.
- On a card for an application, to show which stage it has reached.
When not to use
- On a service with 1 or 2 pages: it adds nothing.
- When the number of pages depends on the answers and you cannot say it: say “Question 3” only, or leave it out. A total that changes is worse than none.
- For an amount, such as rainfall: use a meter.
- For time passing while something loads: GGDS pages should load fast enough not to need it.
How to use
- Put it above the page’s
<h1>. - Write the words in the label: “Question 3 of 4”, “Step 2 of 4: your canoe”, “Done”. The bar only repeats them.
- Use a native
<progress>withvalueandmax: no style attributes, so it works under a strict Content Security Policy. Link the label to it withforandid. - Count the check answers page as a step, and leave out the confirmation page.
Do
- Say the step in words.
- Keep the total the same on every page.
Don't
- Show percentages.
- Make the bar a link or a button.
Accessibility
What GGDS does
- The bar is a native
<progress>, so screen readers say its name and how far along it is (WCAG 4.1.2). - The label is text with at least 4.5 to 1 contrast; the bar is not the only way to see the step (WCAG 1.4.1).
- In Windows contrast themes the bar keeps an outline.
What you need to do
- Give the
<progress>a label, withforandid, so screen readers say what it measures. - Put the same words inside the
<progress>element too, for browsers that do not draw it.
Example: Question 3 of 4
<div class="ggds-progress">
<label class="ggds-progress__label" for="form-progress">Question 3 of 4</label>
<progress class="ggds-progress__bar" id="form-progress" value="3" max="4">Question 3 of 4</progress>
</div>
<h1>Choose a time</h1><>
<div className="ggds-progress">
<label className="ggds-progress__label" htmlFor="form-progress">Question 3 of 4</label>
<progress className="ggds-progress__bar" id="form-progress" value="3" max="4">Question 3 of 4</progress>
</div>
<h1>Choose a time</h1>
</>Use it
- Stylesheet
ggds.cssincludes it. To load only the parts you use:core.css, thencomponents/progress.css(0.4 KB with gzip, minified).- JavaScript
- None needed.
HTML
Copy the HTML under each example above. It works in any website.
Astro
No Astro component: copy the HTML.
React and Next.js
With @ggds/react:
import { Progress } from '@ggds/react';
<Progress current={3} total={4} /> {/* "Question 3 of 4" */}Django
With ggds-django ({% load ggds %}):
{% ggds_progress 3 4 %}Classes and states
| Class | What it does |
|---|---|
.ggds-progress | The label and the bar together. |
.ggds-progress__label | The words: “Question 3 of 4”. A <label> for the bar. |
.ggds-progress__bar | The bar: a native <progress> with value and max. |
Accessibility tests
Automated, on every change
These run each time GGDS changes. A change that fails one is not accepted.
- WCAG 2.2 A and AA rules (axe), at desktop and phone widths, on every example
- No sideways scrolling on a 320px screen, also with a wide font, on every example
- Every approved colour pair meets its contrast minimum, for every institution theme
- No inline scripts or styles, so it runs under a strict Content Security Policy
By people, with assistive technology
Automated tests find only some of the barriers people meet. These checks are still to be done.
| Check | Result | Notes |
|---|---|---|
| Keyboard only | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| NVDA screen reader with Firefox or Chrome (Windows) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| JAWS screen reader with Chrome (Windows) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| VoiceOver screen reader with Safari (iPhone) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| TalkBack screen reader with Chrome (Android) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| Zoom to 400%, and increased text spacing | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| Windows contrast themes (forced colours) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| Voice control (Voice Access or Dragon) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
Changes
| Version | Change |
|---|---|
| 0.3.0 | New: progress, "Question 3 of 4" in words and as a native <progress>, so it needs no style attributes. |
| 0.1.0 | Added. |
Related components
Something wrong, unclear or missing? or suggest a change to it on GitHub. You need a GitHub account.