Use breadcrumbs to help users understand where they are in the website.
WCAG 2.2 affects this component
To meet new success criteria introduced in the Web Content Accessibility Guidelines (WCAG) 2.2, make sure that users can successfully:
See the full list of design system changes to meet WCAG 2.2.
<nav class="nhsuk-breadcrumb" aria-label="Breadcrumb">
<ol class="nhsuk-breadcrumb__list">
<li class="nhsuk-breadcrumb__item"><a class="nhsuk-breadcrumb__link" href="#">Level one</a></li>
<li class="nhsuk-breadcrumb__item"><a class="nhsuk-breadcrumb__link" href="#">Level two</a></li>
<li class="nhsuk-breadcrumb__item"><a class="nhsuk-breadcrumb__link" href="#">Level three</a></li>
</ol>
<p class="nhsuk-breadcrumb__back">
<a class="nhsuk-breadcrumb__backlink" href="#">
<span class="nhsuk-u-visually-hidden">Back to </span>
Level three
</a>
</p>
</nav>
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
Name | Type | Required | Description |
---|---|---|---|
items | array | true | Array of breadcrumbs item objects. This should contain all pages in the breadcrumb except for the parent page. |
items[].text | string | true | Text to use within the breadcrumbs item. |
items[].href | string | false | The value of the breadcrumb item link href attribute. |
items[].attributes | object | false | HTML attributes (for example data attributes) to add to the individual crumb. |
text | string | true | Text to use for the parent page. |
href | string | true | The value of the parent page link href attribute. |
classes | string | false | Classes to add to the container. |
attributes | object | false | HTML attributes (for example data attributes) to add to the container. |
{% from 'breadcrumb/macro.njk' import breadcrumb %}
{{ breadcrumb({
items: [
{
href: "#",
text: "Level one"
},
{
href: "#",
text: "Level two"
}
],
href: "#",
text: "Level three"
}) }}
When to use breadcrumbs
Use breadcrumbs to give users context and let them move back or up a level if they can't find what they want on the page.
When not to use breadcrumbs
Don't use breadcrumbs in transactional journeys as they can get in the way of the user completing the task.
How to use breadcrumbs
If the full breadcrumb trail doesn't fit the screen size, it can wrap onto 2 lines, but don't break a breadcrumb if it doesn't fit the line.
Make sure no other interactive elements are too close to the breadcrumbs. This is to make sure users can easily interact with the breadcrumbs. This is to comply with WCAG 2.2 success criterion 2.5.8 Target Size (W3C).
You don't need to show the current page in the breadcrumb because this information is in the H1.
On mobile, we replace the full breadcrumb trail with a "Back to [parent]" link.
Accessibility
We use aria-label="breadcrumb"
as a label in the nav element to let people who use
screen readers know what it is.
We add aria-hidden="true"
to the svg icons
to hide them from people who use screen readers.
Research
We tested breadcrumbs on pages with lots of content about conditions or medicines. They helped people understand their place on the website. People noticed them and appreciated the context they gave. People also used them to get back to where they came from or to get back home.
We took out the breadcrumb links when we tested our pages in transactional journeys (in more than 3 labs). We thought that having extra links would distract users and that fewer people would complete the journey. As we expected, we found that users didn't miss the links because they were focused on the task.
Help us improve this guidance
Share insights or feedback and take part in the discussion. We use GitHub as a collaboration space. All the information on it is open to the public.
Read more about how to feedback or share insights.
If you have any questions, get in touch with the service manual team.
Updated: June 2024