StartFoundationsComponentsContent

Breadcrumb

A breadcrumb shows where the current page sits in a deep hierarchy, as a trail of links back up to the top.

Stable Figma
OverviewUsageAPIAccessibility
Home Docs Components Breadcrumb
<tk-breadcrumb>
  <tk-breadcrumb-item href="/">Home</tk-breadcrumb-item>
  <tk-breadcrumb-item href="/docs">Docs</tk-breadcrumb-item>
  <tk-breadcrumb-item href="/docs/components">Components</tk-breadcrumb-item>
  <tk-breadcrumb-item>Breadcrumb</tk-breadcrumb-item>
</tk-breadcrumb>

Anatomy

Part What it is
tk-breadcrumb a navigation landmark holding an ordered list
tk-breadcrumb-item with href an ancestor page: a muted link
last tk-breadcrumb-item without href the current page: plain, darker text, not a link
separator a chevron between crumbs; decorative
overflow button when collapsed, a "…" button opening a menu of the hidden crumbs

Crumbs

  • An item with href is a link. It is a Link with the quiet look: muted at rest, darker and underlined on hover and focus. target and rel pass through to it.
  • The last item without href is the current page. It isn't focusable and screen readers hear it as the current page.
  • To end the trail at the parent, leave the current page out. Every crumb is then a link.
  • To use your router's links, leave out href and put your own <a> in the item.

Separator

Put a glyph in the separator slot to replace the chevron in every gap. It stays decorative.

/ Home Blog Release notes
<tk-breadcrumb>
  <span slot="separator">/</span>
  <tk-breadcrumb-item href="/">Home</tk-breadcrumb-item>
  <tk-breadcrumb-item href="/blog">Blog</tk-breadcrumb-item>
  <tk-breadcrumb-item>Release notes</tk-breadcrumb-item>
</tk-breadcrumb>

Collapse a long trail

max-items keeps a long trail short. When there are more crumbs than that, only the first and last stay, and a "…" button between them opens a menu of the rest. Choosing one goes to that page.

Home Store Pet supplies Cats Food Wet food
<tk-breadcrumb max-items="4">
  <tk-breadcrumb-item href="/">Home</tk-breadcrumb-item>
  <tk-breadcrumb-item href="/store">Store</tk-breadcrumb-item>
  <tk-breadcrumb-item href="/store/pets">Pet supplies</tk-breadcrumb-item>
  <tk-breadcrumb-item href="/store/pets/cats">Cats</tk-breadcrumb-item>
  <tk-breadcrumb-item href="/store/pets/cats/food">Food</tk-breadcrumb-item>
  <tk-breadcrumb-item>Wet food</tk-breadcrumb-item>
</tk-breadcrumb>
  • The button's name says how many crumbs it hides: "Show 4 more breadcrumbs".
  • Crumbs in the menu don't open in a new tab or show a link's context menu. The first and last crumbs stay real links.
  • Without max-items, a trail too long for its container wraps onto a second line.

Icons

Put a tk-icon in an item before its text, usually on the first crumb. An icon with text needs nothing else. If the icon is the whole crumb, give it a label; that becomes the link's name.

Security
<tk-breadcrumb>
  <tk-breadcrumb-item href="/account"><tk-icon name="user" label="Account"></tk-icon></tk-breadcrumb-item>
  <tk-breadcrumb-item>Security</tk-breadcrumb-item>
</tk-breadcrumb>