Components

Breadcrumbs

The breadcrumbs component helps users to understand where they are within a website’s structure and move between levels.

<div class="govuk-breadcrumbs">
  <ol class="govuk-breadcrumbs__list">
    <li class="govuk-breadcrumbs__list-item">
      <a class="govuk-breadcrumbs__link" href="#">Home</a>
    </li>
    <li class="govuk-breadcrumbs__list-item">
      <a class="govuk-breadcrumbs__link" href="#">Passports, travel and living abroad</a>
    </li>
    <li class="govuk-breadcrumbs__list-item" aria-current="page">Travel abroad</li>
  </ol>
</div>
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.

Primary options
Name Type Description
items array Required. Array of breadcrumbs item objects. See items.
classes string Classes to add to the breadcrumbs container.
attributes object HTML attributes (for example data attributes) to add to the breadcrumbs container.
Options for items
Name Type Description
text string Required. If html is set, this is not required. Text to use within the breadcrumbs item. If html is provided, the text argument will be ignored.
html string Required. If text is set, this is not required. HTML to use within the breadcrumbs item. If html is provided, the text argument will be ignored.
href string Link for the breadcrumbs item. If not specified, breadcrumbs item is a normal list item.
{% from "breadcrumbs/macro.njk" import govukBreadcrumbs %}

{{ govukBreadcrumbs({
  items: [
    {
      text: "Home",
      href: "#"
    },
    {
      text: "Passports, travel and living abroad",
      href: "#"
    },
    {
      text: "Travel abroad"
    }
  ]
}) }}

When to use this component

Use the breadcrumbs component when you need to help users understand and move between the multiple levels of a website.

When not to use this component

Do not use the breadcrumbs component on websites with a flat structure, or to show progress through a linear journey or transaction.

If you’re using other navigational elements on the page, such as a sidebar, consider whether your users need the additional support of breadcrumbs.

How it works

The breadcrumbs component should include the user’s current page, which should be visually different from the other links in the breadcrumb.

There are 2 ways to use the breadcrumbs component. You can use HTML or, if you are using Nunjucks or the GOV.UK Prototype Kit, you can use the Nunjucks macro.

<div class="govuk-breadcrumbs">
  <ol class="govuk-breadcrumbs__list">
    <li class="govuk-breadcrumbs__list-item">
      <a class="govuk-breadcrumbs__link" href="#">Home</a>
    </li>
    <li class="govuk-breadcrumbs__list-item">
      <a class="govuk-breadcrumbs__link" href="#">Passports, travel and living abroad</a>
    </li>
    <li class="govuk-breadcrumbs__list-item" aria-current="page">Travel abroad</li>
  </ol>
</div>
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.

Primary options
Name Type Description
items array Required. Array of breadcrumbs item objects. See items.
classes string Classes to add to the breadcrumbs container.
attributes object HTML attributes (for example data attributes) to add to the breadcrumbs container.
Options for items
Name Type Description
text string Required. If html is set, this is not required. Text to use within the breadcrumbs item. If html is provided, the text argument will be ignored.
html string Required. If text is set, this is not required. HTML to use within the breadcrumbs item. If html is provided, the text argument will be ignored.
href string Link for the breadcrumbs item. If not specified, breadcrumbs item is a normal list item.
{% from "breadcrumbs/macro.njk" import govukBreadcrumbs %}

{{ govukBreadcrumbs({
  items: [
    {
      text: "Home",
      href: "#"
    },
    {
      text: "Passports, travel and living abroad",
      href: "#"
    },
    {
      text: "Travel abroad"
    }
  ]
}) }}

Research on this component

If you’ve used this component, get in touch to share your user research findings.

Get in touch

If you’ve got a question, idea or suggestion share it in #govuk-design-system on cross-government Slack (open in app) or email the Design System team on govuk-design-system-support@digital.cabinet-office.gov.uk

Discuss ‘Breadcrumbs’ on GitHub