Skip to content
Slotted

Breadcrumb

A trail of links from the root of the application to the current page, which folds when it gets too deep or too wide for its container.

Installation

The packages are a 0.x beta on npm, and their public API changes between beta releases without deprecation. One line installs the binding and the default theme.

bash
pnpm add @slotted/react @slotted/theme @slotted/themes
tsx
import { Breadcrumb, BreadcrumbDefaultsProvider, BreadcrumbItem,  BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbTrigger } from '@slotted/react';

The current page

A trail is a nav landmark around an ordered list. Each ancestor is a BreadcrumbLink in React and an a with slBreadcrumbLink in Angular. The last crumb is a BreadcrumbPage, a span that carries aria-current="page" and takes more weight than the links before it. It is text rather than a link, because a link to the page the reader is already on goes nowhere. Every item draws the separator after itself except the last, so no crumb writes one.

Separator

With no separator, the stylesheet draws a one-pixel rule rotated into a slash, which mirrors in a right-to-left document. Any content in the separator replaces the drawing and keeps the element, which stays aria-hidden. React takes a ReactNode; Angular takes a TemplateRef, rendered once per item.

Above a page heading

A trail sits above the heading of the page it describes, at the type size of the interface rather than of the page title. It shows where the page sits in the hierarchy, not where the reader came from, so it never stands in for a back button.

INV-2026-08-0041

Kiln & Co. · Net 30 · due September 12, 2026

Collapsing a deep trail

Above maxItems crumbs, the middle of the trail folds behind one ellipsis button. itemsBeforeCollapse crumbs at the start and itemsAfterCollapse at the end never fold. The defaults are 8, 1 and 2, and maxItems={0} never folds by count. The ellipsis names how many crumbs it holds, and the root carries the same number in data-collapsed. A press, or Enter or Space, expands the trail in place with no overlay, and focus moves to the first crumb the press revealed. This trail has seven crumbs and maxItems of 4, so the four in the middle fold.

Starting expanded

defaultExpanded starts the trail unfolded and is read once. An expanded trail has no ellipsis, so nothing in the trail folds it again.

Controlled expansion

expanded makes the application the owner of the state. A press on the ellipsis calls onExpandedChange(expanded, request) in React and emits expandedChange in Angular, with a ChangeRequest whose value is true, whose reason is pointer or keyboard, and whose cancellation commits nothing. The trail expands only when the application passes true back, and it folds again when the application passes false. Here the button folds the trail again.

Folded

Overflow by width

With overflow="collapse", the default, the trail measures its container and folds the middle crumbs that do not fit into the same ellipsis. The crumb nearest the root folds first, so the folded run stays beside the ellipsis. overflow="wrap" keeps every crumb and breaks the row onto further lines instead. A trail that has been expanded does not fold by width, because expanding was the reader’s choice; a narrower container wraps it. A count that already folds the trail leaves nothing for the width to fold. The first trail below folds in this column and the second wraps.

Crumbs that switch between siblings

A crumb that moves between siblings, such as a ledger or a period, opens a menu of them. BreadcrumbTrigger is a button with a chevron after its label, because an a without href takes no focus. In React, MenuTrigger hands its wiring to a BreadcrumbTrigger through render. In Angular, slMenuTriggerFor goes on the same button. current keeps aria-current="page" on the switcher of the page the reader is on, so the end of the trail is still announced as the current page when it opens a menu.

Long and single-crumb trails

A trail whose fixed crumbs alone exceed its width wraps, and the widest crumb truncates with an ellipsis. The full string stays in the DOM and in the accessible name. A trail whose only crumb is the page draws no separator.

Defaults for an application

BreadcrumbDefaultsProvider in React and provideBreadcrumbDefaults in Angular set maxItems, itemsBeforeCollapse, itemsAfterCollapse, overflow and separator once for every trail below them. A prop or an input on a trail still wins. Here the provider sets maxItems to 4 and itemsAfterCollapse to 1; the second trail states maxItems={0} and overflow="wrap" and keeps every crumb.

Inherits the defaults
maxItems=0 and overflow="wrap" on the trail

Messages

messages replaces the words of one trail, key by key: label names the landmark and showHidden names the ellipsis, with the number of folded crumbs in {count}. The words come from the language in force when messages is absent. A static aria-label on the nav wins over label in both frameworks.

Each part accepts the application’s own element. In React, render on BreadcrumbLink receives the props to spread on a router link, and every data attribute reaches it. In Angular, slBreadcrumbLink claims no destination, so routerLink stays on the anchor that already carries the directive.

Accessibility

KeyEffectFocus
Tabmoves to each link in the trail, and to the ellipsis when the trail is collapsedthe next control
Enterfollows the focused linkthe destination
Enterexpands a collapsed trail when the ellipsis has focusthe first revealed link, because the ellipsis stops existing
Spaceexpands a collapsed trail when the ellipsis has focusthe first revealed link, because the ellipsis stops existing
  • The rendered elements are a nav and an ol, which is the whole of the APG Breadcrumb pattern: it lists no keyboard interaction, and the two attributes it does list — a name on the landmark and aria-current="page" on the last crumb — are written here rather than reimplemented.
  • The current page is a span rather than a link, because a link to the page the reader is already on goes nowhere. The APG makes aria-current optional there; Breadcrumb writes it anyway, so the end of the trail is announced as this page.
  • The separator is never announced. It is drawn as geometry in CSS — a rotated rule, not a character and not a glyph — which is the same reasoning the APG example gives, and it mirrors from :dir(rtl) so a trail inside a left-to-right island leans the way that island reads.
  • A crumb the collapse hides carries the hidden attribute, so it leaves the accessibility tree with the page. That is the cost of expanding in place rather than into an overlay, and it is paid by the ellipsis: its accessible name says how many crumbs it hides, and it carries aria-expanded.
  • A crumb the width folds is hidden the same way, and the ellipsis counts it with the others. Hiding only the label of a narrow crumb would leave the link named by nothing but an aria-hidden icon; a folded crumb is out of the tree whole, and the ellipsis says so.
  • A switcher is a button with aria-haspopup from the menu composed on it, and the switcher of this page keeps aria-current="page", so the end of the trail is still announced as the current page when it opens a menu.
  • Pressing the ellipsis removes it, so focus is given to the first crumb it revealed. Focus on a removed element falls to the body, which is the defect that rule exists to prevent.
  • A crumb wider than the trail truncates with an ellipsis, and the full string stays in the DOM and in the accessible name — the same rule every truncated string follows.

API

Breadcrumb

Props

messagesPartial<BreadcrumbMessages>
Words laid over the language in force, key by key: the landmark's name (label) and the ellipsis (showHidden)
maxItemsnumberDefault 8
The count above which the trail folds; 0 never folds
itemsBeforeCollapsenumberDefault 1
How many crumbs survive at the start of a folded trail
itemsAfterCollapsenumberDefault 2
How many survive at its end
expandedboolean
Present means controlled, for the life of the component
defaultExpandedbooleanDefault false
What an uncontrolled trail starts from, read once
overflow'collapse' | 'wrap'Default collapse
What the trail does with crumbs its width cannot hold: fold the middle into the ellipsis, or wrap
separatorReactNode
The mark between two crumbs. Absent, the stylesheet draws a rotated rule
hrefstring
On BreadcrumbLinkThe destination, and every other anchor attribute reaches the element unchanged
currentbooleanDefault false
On BreadcrumbTriggerThe switcher of the page the reader is on: writes aria-current="page" and takes the page weight

Events

NamePayloadWhen
onExpandedChange(expanded: boolean, request: ChangeRequest<boolean>)Before the trail expands. The request carries the value it replaces, the reason — pointer or keyboard — and the originating event, and cancelling it commits nothing.

Composition

render(props) => ReactNode
On every partSubstitutes the rendered element. Every data attribute is handed to it, so a router link keeps them.
refRef<HTMLElement>
On every partReaches the element, and focus() with it
useBreadcrumb()() => BreadcrumbContextValue
On inside a BreadcrumbThe collapse state and the request that moves it, for a control the application writes
BreadcrumbDefaultsProvidermaxItems | itemsBeforeCollapse | itemsAfterCollapse | overflow | separator
On ApplicationSets those five once for everything below it; a prop on the trail still wins

Parts

PartElementRequiredPurpose
rootnavYesThe navigation landmark and its name. Carries data-ui="breadcrumb", data-expanded, and data-collapsed with the count of folded crumbs, and owns the collapse.
listolYesThe ordered list, which is what carries the hierarchy and the set size. It decides which crumbs the collapse hides, by count and, with overflow="collapse", by its own width.
itemliYesOne ancestor, or the current page. It renders the separator after itself, and carries hidden while the collapse hides it.
linkaNoAn ancestor that can be reached. A plain anchor, substitutable through render.
pagespanNoThe page the reader is on, carrying aria-current="page". Text rather than a link, because a link to this page goes nowhere.
triggerbuttonNoA crumb that opens a menu of its siblings, with a chevron after its label. The menu is composed around it; current keeps aria-current="page" on the switcher of this page.
separatorspanNoDrawn between two crumbs, never after the last, never announced. Empty by default, when the stylesheet draws a rotated rule; anything inside replaces it.
ellipsisbuttonNoWhat the collapse hides, in an item of its own in front of the first crumb that can fold, and the control that reveals it. Its accessible name carries the count.

Theming

Each token is a CSS custom property: set it in a theme, or on any element to retune every breadcrumb inside it.

Breadcrumb tokens

TokenDefault
--slotted-breadcrumb-colorvar(--slotted-text-muted, GrayText)
--slotted-breadcrumb-color-currentvar(--slotted-text, CanvasText)
--slotted-breadcrumb-color-hovercolor-mix(in oklab, var(--_rest) 30%, var(--_strong))
--slotted-breadcrumb-content-gapvar(--slotted-space-3, 6px)
--slotted-breadcrumb-ellipsis-background-activevar(--_ellipsis-active)
--slotted-breadcrumb-ellipsis-background-hovervar(--_ellipsis-hover)
--slotted-breadcrumb-ellipsis-focus-ring-offsetcalc(-1 * var(--slotted-focus-ring-width, 2px))
--slotted-breadcrumb-ellipsis-radiusvar(--slotted-radius-xs, 2px)
--slotted-breadcrumb-focus-ring-offset1px
--slotted-breadcrumb-font-familyvar(--slotted-font-family-sans, inherit)
--slotted-breadcrumb-font-sizevar(--slotted-control-font-size-md, 13px)
--slotted-breadcrumb-gapvar(--slotted-control-gap-md, 8px)
--slotted-breadcrumb-item-measure100%
--slotted-breadcrumb-line-heightvar(--slotted-line-height-md, 1.5)
--slotted-breadcrumb-page-weightvar(--slotted-font-weight-medium, 500)
--slotted-breadcrumb-radiusvar(--slotted-control-radius, 4px)
--slotted-breadcrumb-row-gapvar(--slotted-space-2, 0.25rem)
--slotted-breadcrumb-separator-colorcolor-mix(in oklab, var(--_rest) 72%, transparent)
--slotted-breadcrumb-separator-length0.9em
--slotted-breadcrumb-separator-skew20deg
--slotted-breadcrumb-separator-thicknessvar(--slotted-border-width-thin, 1px)
--slotted-breadcrumb-underline-offset0.2em
--slotted-breadcrumb-underline-thicknessfrom-font

Theme tokens it reads

TokenDefault
--slotted-border-width-thin1px
--slotted-control-font-size-mdcomfortable 13px · compact 12px · dense 12px
--slotted-control-gap-mdcomfortable 8px · compact 6px · dense 4px
--slotted-control-icon-size-mdcomfortable 16px · compact 14px · dense 13px
--slotted-control-inner-size-mdcomfortable 24px · compact 20px · dense 18px
--slotted-control-radiusvar(--slotted-radius-sm)
--slotted-duration-medium200ms
--slotted-duration-short120ms
--slotted-easing-entercubic-bezier(0.05, 0.7, 0.1, 1)
--slotted-easing-standardcubic-bezier(0.2, 0, 0, 1)
--slotted-focus-ring-colorSet per scheme by the theme
--slotted-focus-ring-widthvar(--slotted-border-width-thick)
--slotted-font-family-sans'Geist Variable', ui-sans-serif, system-ui, sans-serif
--slotted-font-weight-medium500
--slotted-line-height-md1.5
--slotted-radius-full9999px
--slotted-radius-xs2px
--slotted-space-20.25rem
--slotted-space-30.375rem
--slotted-target-comfortable44px
--slotted-target-min24px
--slotted-textSet per scheme by the theme
--slotted-text-mutedSet per scheme by the theme
--slotted-tone-secondary-subtle-activeSet per scheme by the theme
--slotted-tone-secondary-subtle-hoverSet per scheme by the theme