About Breadcrumbs
Breadcrumbs are typically constructed with an ol
because their order matters. You mark up breadcrumbs with classes from the horizontal list utility. When you add the slds-breadcrumb
class, the separators are automatically generated.
Accessibility
Place the breadcrumb in a nav
element with role="navigation"
. The nav
element is also marked-up with aria-label="Breadcrumbs"
to describe the type of navigation.
The last breadcrumb item should not be a link since it represents the current page.
Base
Basic Breadcrumbs
Variations
With Overflow
The overflow menu breadcrumbs variant is a composition of the overflow menu with actions example of the menus component and breadcrumbs component. To implement this, include the overflow menu as the first <li>
in the breadcrumb component. In order to vertically align all of the breadcrumb items to the center, add the slds-grid_vertical-align-center
class to the <ol>
.
Long Navigation Path
Interactive Controls
Component API
Basic Breadcrumb Structure
<nav role="navigation" aria-label="Breadcrumbs"> <ol class="slds-breadcrumb slds-list_horizontal slds-wrap"> <li class="slds-breadcrumb__item"> <a href="#">Home</a> </li> <li class="slds-breadcrumb__item"> <a href="#">Parent Item</a> </li> <li class="slds-breadcrumb__item"> <span>Current Item</span> </li> </ol></nav>
With Overflow Menu
<nav role="navigation" aria-label="Breadcrumbs"> <ol class="slds-breadcrumb slds-list_horizontal slds-wrap slds-grid_vertical-align-center"> <li class="slds-breadcrumb__item"> <div class="slds-dropdown-trigger slds-dropdown-trigger_click"> <button class="slds-button slds-button_icon slds-button_icon-border-filled slds-button_icon-x-small" aria-haspopup="true" title="Show More Breadcrumbs"> <svg class="slds-button__icon" aria-hidden="true"> <use href="#down"></use> </svg> <span class="slds-assistive-text">Show More Breadcrumbs</span> </button> <div class="slds-dropdown slds-dropdown_left slds-dropdown_small"> <ul class="slds-dropdown__list" role="menu"> <li class="slds-dropdown__item" role="presentation"> <a href="#" role="menuitem">Hidden Item 1</a> </li> </ul> </div> </div> </li> <li class="slds-breadcrumb__item"> <a href="#">Visible Parent</a> </li> <li class="slds-breadcrumb__item"> <span>Current Item</span> </li> </ol></nav>
Styling Hooks Overview
The breadcrumbs component supports various styling hooks for customization. Key classes include: