Skip to main content

Your privacy settings

We use cookies to help you with journey planning and relevant disruptions, remember your login and show you content you might be interested in. If you’re happy with the use of cookies by West Midlands Combined Authority and our selected partners, click ‘Accept all cookies’. Or click ‘Manage cookies’ to learn more.

Manage Cookies
Beta

This is a new service - your feedback will help us to improve it.

Components

Breadcrumb

About

What does it do?

  • Breadcrumbs help users to understand where they are within a website’s structure.

When to use it?

  • When you need to help users understand and move between the multiple levels of a website.
  • Always make sure that the breadcrumb is contained within a .wmnds-container element. This ensures that the breadcrumb doesn't scale the size of large browser windows.
  • When displaying the current page within the breadcrumb, ensure that the modifier class .wmnds-breadcrumb__link--current is used as seen below.

When not to use it?

  • When websites have flat structure


HTML markup
<nav aria-label="Main example breadcrumbs" class="wmnds-breadcrumb">
  <ol class="wmnds-breadcrumb__list">
    <li class="wmnds-breadcrumb__list-item">
      <a href="/" class="wmnds-breadcrumb__link">
        Home
      </a>
    </li>
    <li class="wmnds-breadcrumb__list-item">
      <a href="#" class="wmnds-breadcrumb__link">
        Components
      </a>
    </li>
    <li class="wmnds-breadcrumb__list-item">
      <a href="#" class="wmnds-breadcrumb__link wmnds-breadcrumb__link--current" aria-current="page">
        Breadcrumb
      </a>
    </li>
  </ol>
</nav>

Nunjucks markup
{% from "wmnds/components/breadcrumb/_breadcrumb.njk" import wmndsBreadcrumb %}

{{
   wmndsBreadcrumb({
      items: [
         {
            contentText: "Components",
            href: "#",
            unlinkedItem: false
         },
         {
            contentText: "Breadcrumb",
            href: "#",
            unlinkedItem: false
         },
      ],
      label: "Breadcrumbs",
      isMobileApp: false
    })
}}

Nunjucks properties
NameTypeDescription
itemsarrayRequired. Array of breadcrumbs item objects. See items below.
classesstringClasses to add to the breadcrumbs container.
labelstringThe accessibility label for the breadcrumb component. If not provided, this will default to 'Breadcrumbs'
isMobileAppbooleanIf true, breadcrumb will only show on devices with a screen resolution bigger than 768px

Options for items

NameTypeDescription
contentTextstringRequired. Text to use within the breadcrumbs item.
hrefstringLink for the breadcrumbs item. If not specified, breadcrumb link will be automatically generated from the contentText strings from the items in the array.
unlinkedItembooleanIf set to true, breadcrumbs item is a normal list item.

Mobile app variant of breadcrumb

When developing a mobile app, if you are limited for space and need extra room then it is recommended to use the mobile app variant of the Transport for West Midlands breadcrumb component.

The mobile app version of the breadcrumb ensures that it will not show on devices with a screen width less than 768px. This means the breadcrumb will only show on devices with a screen resolution bigger than 768px.

To use the mobile app variant:

  • Add the modifier class wmnds-breadcrumb--mobile-app to the wmnds-breadcrumb element

You will most likely want to use this with the mobile variants of the header and footer patterns.



HTML markup
<nav aria-label="Mobile app example breadcrumbs" class="wmnds-breadcrumb wmnds-breadcrumb--mobile-app">
  <ol class="wmnds-breadcrumb__list">
    <li class="wmnds-breadcrumb__list-item">
      <a href="/" class="wmnds-breadcrumb__link">
        Home
      </a>
    </li>
    <li class="wmnds-breadcrumb__list-item">
      <a href="#" class="wmnds-breadcrumb__link">
        Components
      </a>
    </li>
    <li class="wmnds-breadcrumb__list-item">
      <a href="#" class="wmnds-breadcrumb__link wmnds-breadcrumb__link--current" aria-current="page">
        Breadcrumb
      </a>
    </li>
  </ol>
</nav>

Nunjucks markup
{% from "wmnds/components/breadcrumb/_breadcrumb.njk" import wmndsBreadcrumb %}

{{
   wmndsBreadcrumb({
      items: [
         {
            contentText: "Components",
            href: "#",
            unlinkedItem: false
         },
         {
            contentText: "Breadcrumb",
            href: "#",
            unlinkedItem: false
         },
      ],
      label: "Breadcrumbs",
      isMobileApp: false
    })
}}

Nunjucks properties
NameTypeDescription
itemsarrayRequired. Array of breadcrumbs item objects. See items below.
classesstringClasses to add to the breadcrumbs container.
labelstringThe accessibility label for the breadcrumb component. If not provided, this will default to 'Breadcrumbs'
isMobileAppbooleanIf true, breadcrumb will only show on devices with a screen resolution bigger than 768px

Options for items

NameTypeDescription
contentTextstringRequired. Text to use within the breadcrumbs item.
hrefstringLink for the breadcrumbs item. If not specified, breadcrumb link will be automatically generated from the contentText strings from the items in the array.
unlinkedItembooleanIf set to true, breadcrumbs item is a normal list item.