Navigation
Breadcrumbs
A trail of links showing where the page sits in the website.
When to use
- On every page below the homepage, when your website has more than two levels.
- When people often arrive on a deep page from a search engine and need a way up.
When not to use
- On the homepage.
- To show steps in a form. Breadcrumbs take people out of the form.
- As the only way to move around. People still need the header.
How to use
- Put the breadcrumbs at the top of the page, above the main heading.
- Start with "Home", then one link for each level above this page.
- Show where the page sits in the website, not the pages the visitor came through.
- Use the same names as the pages' headings, shortened if they are long.
- The last item is the current page. Do not link it, and mark it with
aria-current="page". - On a narrow phone the trail wraps onto more lines; nothing is cut off. Short names keep it to one or two lines.
Do
- Keep the trail the same on every page in a section.
- Use short names: "Services", not "Our services to the public".
Don't
- Link the current page to itself.
- Type ">" or "/" between items; GGDS draws the arrows.
Accessibility
What GGDS does
- It is a navigation area with an ordered list, so screen readers say how many steps there are.
- The arrows between steps are drawn in CSS, so screen readers do not read them out.
- Each link is at least 24px tall (WCAG 2.5.8), and the trail wraps instead of making the page scroll sideways.
What you need to do
- Name it:
<nav aria-label="Breadcrumb">. - Make the last step the current page: not a link, with
aria-current="page". - Use one breadcrumb trail per page.
Example: Breadcrumbs
<nav class="ggds-breadcrumbs" aria-label="Breadcrumb">
<ol class="ggds-breadcrumbs__list">
<li class="ggds-breadcrumbs__item"><a class="ggds-breadcrumbs__link" href="/">Home</a></li>
<li class="ggds-breadcrumbs__item"><a class="ggds-breadcrumbs__link" href="/services/">Services</a></li>
<li class="ggds-breadcrumbs__item" aria-current="page">Apply for a licence</li>
</ol>
</nav><nav className="ggds-breadcrumbs" aria-label="Breadcrumb">
<ol className="ggds-breadcrumbs__list">
<li className="ggds-breadcrumbs__item"><a className="ggds-breadcrumbs__link" href="/">Home</a></li>
<li className="ggds-breadcrumbs__item"><a className="ggds-breadcrumbs__link" href="/services/">Services</a></li>
<li className="ggds-breadcrumbs__item" aria-current="page">Apply for a licence</li>
</ol>
</nav>Use it
- Stylesheet
ggds.cssincludes it. To load only the parts you use:core.css, thencomponents/navigation.css(0.9 KB with gzip, minified), which also holds breadcrumbs, pagination and tab links.- 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 { Breadcrumbs } from '@ggds/react';
<Breadcrumbs current="Apply for a licence"
items={[{ label: 'Home', href: '/' }, { label: 'Services', href: '/services/' }]} />Django
With ggds-django ({% load ggds %}):
{% ggds_breadcrumbs crumbs %}Classes and states
| Class | What it does |
|---|---|
.ggds-breadcrumbs | The <nav aria-label="Breadcrumb">. |
.ggds-breadcrumbs__list | The trail, as an ordered list that wraps. |
.ggds-breadcrumbs__item | One step, with an arrow drawn before every step after the first. |
.ggds-breadcrumbs__link | A link to a page above this one. |
| State | What it does |
|---|---|
aria-current="page" on the last item | The current page: plain text, not a link. |
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.2.0 | Fuller guidance for tags, breadcrumbs, disclosures, the skip link, pagination, rich text, tables and tab links. |
| 0.1.0 | New: ggds-django, for Django and Django-based CMSs such as Wagtail: the page parts as template tags, a form renderer that turns any Django form into GGDS markup with an error summary and accessible errors, and the GGDS styles, themes and script as static files. |
| 0.1.0 | Added. |
Related components
Something wrong, unclear or missing? or suggest a change to it on GitHub. You need a GitHub account.