Skip to content

Breadcrumb

NavigationSince 0.2.0

Show where the current page sits in a hierarchy and let users jump to its ancestors. Breadcrumb implements the WAI-ARIA APG Breadcrumb pattern: a labelled <nav> with an ordered list of links, the current page marked with aria-current="page". Long trails can collapse behind an expander. Hrefs are validated (http(s) and relative URLs only), and a cancelable aui-navigate event lets client-side routers take over.

  • Clear locationA navigation landmark with the current page marked for assistive technology.
  • Collapses long trailsA maximum item count folds the middle of long trails into an expandable item.
  • Cancelable navigationNavigate events can be canceled to hand links to a client-side router.
  • Localized and RTLLabels follow the locale and separators mirror in right-to-left layouts.

Use it for

  • Hierarchical sites or apps where users benefit from seeing and jumping to ancestor pages.
  • Deep pages reached from search or links, to show where the page sits.

Use something else for

  • Flat sites with one or two levels.
  • Showing browsing history (breadcrumbs show hierarchy, not the path taken).
  • Sequential processes: use a stepper.
Anatomy
<div class="aui-breadcrumb"> (consumer host)
<nav class="aui-breadcrumb__nav" aria-label="Breadcrumb">
<ol class="aui-breadcrumb__list">
<li class="aui-breadcrumb__item"><a class="aui-breadcrumb__link" href="/">Home</a></li>
<li class="aui-breadcrumb__item aui-breadcrumb__item--collapsed"> (when collapsed)
<svg class="aui-icon aui-breadcrumb__separator" aria-hidden="true">
<button class="aui-breadcrumb__expander" aria-label="Show all breadcrumbs"><span aria-hidden="true">...</span></button>
</li>
<li class="aui-breadcrumb__item">
<svg class="aui-icon aui-breadcrumb__separator" aria-hidden="true">
<span class="aui-breadcrumb__text" aria-current="page">Current</span>
</li>
</ol>
</nav>
</div>

Use the bar above each frame to switch theme, density, direction, and locale.

Section titled “Breadcrumb in the Application shell showcase”

The part of the Application shell showcase that uses Breadcrumb. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.

Showcase source
// Navigation showcase: an application shell with a collapsible sidebar, a menu bar, breadcrumb,
// tabs, a stepper, pagination, an actions menu, and a context menu, all kept in sync.
import { Breadcrumb } from '@absoluteui/components/breadcrumb';
import { Button } from '@absoluteui/components/button';
import { ContextMenu } from '@absoluteui/components/context-menu';
import { Menu, type MenuItem } from '@absoluteui/components/menu';
import { MenuBar } from '@absoluteui/components/menu-bar';
import { Pagination, type PaginationChangeDetail } from '@absoluteui/components/pagination';
import { Sidebar, type SidebarChangeDetail } from '@absoluteui/components/sidebar';
import { Stepper } from '@absoluteui/components/stepper';
import { Tabs } from '@absoluteui/components/tabs';
import { annotate, choice, createShowcase, hostIn, section, toggle } from './kit.js';
const sc = createShowcase({
title: 'Application shell',
description: 'Choose a page in the sidebar, open menus with the keyboard, switch tabs, step through onboarding, and page through results.',
});
// The shell (sidebar, menu bar, breadcrumb, actions menu, tabs); the directory and the stepper
// follow in their own sections, so each component's focus view stays small.
const shell = annotate(hostIn(sc.stage), ['sidebar', 'menu-bar', 'breadcrumb', 'menu', 'tabs']);
shell.className = 'sc-shell';
const side = hostIn(shell);
side.className = 'sc-shell__side';
const main = hostIn(shell, 'main');
main.className = 'sc-shell__main';
const PAGES: Record<string, string> = { dashboard: 'Dashboard', people: 'People', teams: 'Teams', payroll: 'Payroll', reports: 'Reports', settings: 'Settings' };
const sidebar = Sidebar.create(side, {
label: 'Main',
value: 'people',
collapsible: true,
expanded: ['org'],
items: [
{ id: 'dashboard', label: 'Dashboard', icon: 'list-bulleted' },
{ type: 'group', id: 'org', label: 'Organization', icon: 'menu', items: [
{ id: 'people', label: 'People' },
{ id: 'teams', label: 'Teams' },
] },
{ id: 'payroll', label: 'Payroll', icon: 'file' },
{ id: 'reports', label: 'Reports', icon: 'filter' },
{ id: 'settings', label: 'Settings', icon: 'more-horizontal', disabled: true },
],
});
const bar = MenuBar.create(hostIn(main), {
label: 'Application',
items: [
{ id: 'file', label: 'File', items: [{ id: 'new', label: 'New employee' }, { id: 'import', label: 'Import…' }, { type: 'separator' }, { id: 'export', label: 'Export CSV' }] },
{ id: 'view', label: 'View', items: [{ type: 'checkbox', id: 'compact', label: 'Compact rows', checked: false }, { type: 'checkbox', id: 'photos', label: 'Show photos', checked: true }, { type: 'separator' }, { type: 'radio', id: 'sort-name', label: 'Sort by name', group: 'sort', checked: true }, { type: 'radio', id: 'sort-date', label: 'Sort by start date', group: 'sort', checked: false }] },
{ id: 'help', label: 'Help', items: [{ id: 'shortcuts', label: 'Keyboard shortcuts' }, { id: 'about', label: 'About' }] },
],
});
const crumbs = Breadcrumb.create(hostIn(main), { items: [{ label: 'Home', href: '#home' }, { label: 'Organization', href: '#org' }, { label: 'People' }] });
const title = document.createElement('h2');
title.className = 'sc-shell__title';
title.textContent = 'People';
main.append(title);
const actionsRow = hostIn(main);
actionsRow.className = 'sc-row';
const trigger = Button.create({ text: 'Actions', icon: 'chevron-down', iconPosition: 'end' }, document);
actionsRow.append(trigger.element);
const actionItems: MenuItem[] = [
{ id: 'invite', label: 'Invite people', icon: 'plus' },
{ id: 'download', label: 'Download list', icon: 'download' },
{ type: 'separator' },
{ type: 'group', label: 'Danger zone', items: [{ id: 'archive', label: 'Archive team', icon: 'trash' }] },
];
Menu.create(trigger.element, { items: actionItems, label: 'Actions' });
const tabs = Tabs.create(hostIn(main), {
label: 'People views',
tabs: [
{ id: 'directory', label: 'Directory' },
{ id: 'onboarding', label: 'Onboarding' },
{ id: 'archived', label: 'Archived', disabled: true },
],
value: 'directory',
});
// Directory: a list with a context menu and pagination.
const people = ['Ada Kowalski', 'Bruno Silva', 'Chen Wei', 'Divya Nair', 'Emeka Obi', 'Farah Haddad', 'Grace Liu', 'Hiro Tanaka', 'Inés García', 'Jonas Berg', 'Kofi Mensah', 'Lena Novak', 'Mateo Rossi', 'Nora Lind', 'Omar Aziz', 'Priya Shah', 'Quinn Moore', 'Rosa Diaz', 'Sami Kallio', 'Tomas Weber', 'Uma Rao', 'Victor Hugo', 'Wen Li'];
const pageSize = 5;
const directoryText = document.createElement('p');
directoryText.textContent = `${String(people.length)} people in Organization.`;
tabs.panel('directory')?.append(directoryText);
const directory = section(sc, 'People directory', ['pagination', 'context-menu']);
const list = document.createElement('ul');
list.className = 'sc-people';
list.tabIndex = 0;
list.setAttribute('aria-label', 'People on this page. Press Shift+F10 or the context menu key for actions.');
directory.append(list);
const pager = Pagination.create(hostIn(directory), { page: 1, total: people.length, pageSize, pageSizes: [5, 10], showSummary: true, showFirstLast: true });
let size = pageSize;
const renderPage = (page: number): void => {
list.replaceChildren(
...people.slice((page - 1) * size, page * size).map((p) => {
const li = document.createElement('li');
li.textContent = p;
return li;
}),
);
};
renderPage(1);
pager.host.addEventListener('aui-change', (e) => {
const d = (e as CustomEvent<PaginationChangeDetail>).detail;
size = d.pageSize ?? size;
renderPage(d.page);
});
ContextMenu.create(list, {
label: 'Person actions',
items: [
{ id: 'open', label: 'Open profile' },
{ id: 'message', label: 'Send message' },
{ type: 'separator' },
{ type: 'checkbox', id: 'favorite', label: 'Favorite', checked: false },
],
});
// Onboarding: a stepper.
const onboardingText = document.createElement('p');
onboardingText.textContent = 'Onboarding: one of four steps complete.';
tabs.panel('onboarding')?.append(onboardingText);
const onboarding = section(sc, 'Onboarding', ['stepper']);
const stepper = Stepper.create(hostIn(onboarding), {
label: 'Onboarding',
linear: true,
value: 'details',
steps: [
{ id: 'account', label: 'Account', description: 'Email and sign-in', status: 'complete' },
{ id: 'details', label: 'Details', description: 'Role and team' },
{ id: 'documents', label: 'Documents', description: 'Contract and ID' },
{ id: 'review', label: 'Review' },
],
});
sidebar.host.addEventListener('aui-change', (e) => {
const value = (e as CustomEvent<SidebarChangeDetail>).detail.value;
const label = PAGES[value] ?? value;
title.textContent = label;
crumbs.update({ items: [{ label: 'Home', href: '#home' }, ...(value === 'people' || value === 'teams' ? [{ label: 'Organization', href: '#org' }] : []), { label }] });
});
sc.listen(sidebar.host, ['aui-change', 'aui-collapsed-change', 'aui-expanded-change'], 'sidebar');
sc.listen(bar.host, ['aui-select'], 'menu bar');
sc.listen(trigger.element, ['aui-select'], 'actions menu');
sc.listen(list, ['aui-select'], 'context menu');
sc.listen(tabs.host, ['aui-change'], 'tabs');
sc.listen(stepper.host, ['aui-change'], 'stepper');
sc.listen(pager.host, ['aui-change'], 'pagination');
sc.listen(crumbs.host, ['aui-navigate'], 'breadcrumb');
crumbs.host.addEventListener('click', (e) => {
if (e.target instanceof HTMLAnchorElement) e.preventDefault();
});
toggle(sc, 'Sidebar collapsed', false, (collapsed) => {
sidebar.update({ collapsed });
}, ['sidebar']);
toggle(sc, 'Linear stepper', true, (linear) => {
stepper.update({ linear });
}, ['stepper']);
choice(
sc,
'Tabs activate',
[
{ value: 'automatic', label: 'On focus' },
{ value: 'manual', label: 'On Enter or Space' },
],
'automatic',
(activation) => {
tabs.update({ activation });
},
['tabs'],
);
import { Breadcrumb } from '@absoluteui/components/breadcrumb';
const host = document.createElement('div');
document.body.append(host);
Breadcrumb.create(host, {
items: [
{ label: 'Home', href: '/' },
{ label: 'Products', href: '/products' },
{ label: 'Laptops', href: '/products/laptops' },
],
});
import { Breadcrumb, type BreadcrumbNavigateDetail } from '@absoluteui/components/breadcrumb';
const host = document.createElement('div');
document.body.append(host);
const navigate = (path: string): void => {
history.pushState(null, '', path);
};
Breadcrumb.create(host, {
maxItems: 3,
items: [
{ label: 'Home', href: '/' },
{ label: 'Projects', href: '/projects' },
{ label: 'Atlas', href: '/projects/atlas' },
{ label: 'Settings', href: '/projects/atlas/settings' },
{ label: 'Members' },
],
});
host.addEventListener('aui-navigate', (event) => {
const { item } = (event as CustomEvent<BreadcrumbNavigateDetail>).detail;
if (item.href !== undefined) {
event.preventDefault();
navigate(item.href);
}
});
Terminal window
npm install @absoluteui/components @absoluteui/core @absoluteui/theme

Registry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.

import { Breadcrumb } from '@absoluteui/components/breadcrumb';
import '@absoluteui/components/breadcrumb/style.css';
import { Breadcrumb, type BreadcrumbNavigateDetail } from '@absoluteui/components/breadcrumb';
import '@absoluteui/components/breadcrumb/style.css';
const host = document.querySelector<HTMLElement>('#trail');
if (host) {
Breadcrumb.create(host, { maxItems: 3, items: [{ label: 'Home', href: '/' }, { label: 'Docs', href: '/docs' }, { label: 'API', href: '/docs/api' }, { label: 'Tabs' }] });
host.addEventListener('aui-navigate', (event) => {
const { item } = (event as CustomEvent<BreadcrumbNavigateDetail>).detail;
if (item.href !== undefined) {
event.preventDefault();
history.pushState(null, '', item.href);
}
});
}
More usage
import { Breadcrumb } from '@absoluteui/components/breadcrumb';
const host = document.createElement('div');
document.body.append(host);
Breadcrumb.create(host, {
items: [
{ label: 'Home', href: '/' },
{ label: 'Products', href: '/products' },
{ label: 'Laptops' },
],
});

Using Angular? See Breadcrumb for Angular.

Breadcrumb.create(host: HTMLElement, options: BreadcrumbOptions): Breadcrumb

Global configuration key: breadcrumb (see Configuration).

Option Type Default Description
items readonly { label: string; href?: string }[] Trail from the root to the current page (last item). Items without href render as text. Required.
label string "Breadcrumb (localized)" Accessible name of the <nav>.
linkCurrent boolean false Render the current (last) item as a link when it has an href.
icons Partial<{ separator: IconRef }> Icon slot overrides.
maxItems number 0 0 never collapses. Otherwise (>= 2), longer trails show the first item, an expander, and the last maxItems - 1 items. Globally configurable.
locale string "en-US" Message locale. Globally configurable. Inherited from common configuration.
direction 'ltr' | 'rtl' "ltr" rtl mirrors the separator icon. Globally configurable. Inherited from common configuration.
Property Type Description
host HTMLElement Consumer host; its children are owned by the component.
nav HTMLElement The <nav> landmark.
expanded boolean Whether the user expanded a collapsed trail.
options Readonly<BreadcrumbOptions> Current instance options.
Method Description
update(options: Partial<BreadcrumbOptions>): void Merge and apply options. New items collapse again.
destroy(): void Remove rendering, listeners, and subscriptions.
Event Detail Bubbles Cancelable Description
aui-navigate { index: number; item: BreadcrumbItem } Yes Yes An unmodified primary click on a link. preventDefault stops native navigation so a router can handle it.

All rules live in the aui.components cascade layer, so application styles override them without specificity battles.

Class Purpose
aui-breadcrumb Host.
aui-breadcrumb--rtl Configured rtl direction.
aui-breadcrumb__nav The <nav> landmark.
aui-breadcrumb__list The <ol>.
aui-breadcrumb__item An <li>; –collapsed for the expander item.
aui-breadcrumb__link Item link.
aui-breadcrumb__text Text item (current page or no href).
aui-breadcrumb__separator Decorative separator icon.
aui-breadcrumb__expander Button that reveals collapsed items.
Slot Default icon
separator chevron-right

Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.

--aui-color-focus-ring | --aui-color-hover | --aui-color-link | --aui-color-text | --aui-color-text-muted | --aui-control-height-sm | --aui-focus-ring-offset | --aui-focus-ring-width | --aui-font-family-sans | --aui-font-size-sm | --aui-font-weight-medium | --aui-icon-size-sm | --aui-line-height-normal | --aui-radius-sm | --aui-space-1 | --aui-space-2

TypeScript definitions
interface BreadcrumbItem { label: string; href?: string }
interface BreadcrumbIcons { separator: IconRef }
interface BreadcrumbNavigateDetail { index: number; item: BreadcrumbItem }

Pattern: WAI-ARIA APG Breadcrumb pattern.

Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.

Key Context Action
Tab / Shift+Tab Any Moves between links and the expander button (native tab order).
Enter Link focused Follows the link; emits cancelable aui-navigate first.
Enter / Space Expander focused Reveals the full trail in place and moves focus to the first revealed item.
Element Role
<nav> navigation (native landmark)
<ol> list (native)
<a href> link (native)
expander <button> button (native)
Attribute Element Value
aria-label <nav> label option or localized ‘Breadcrumb’
aria-current last item page
aria-hidden separator icons, expander ellipsis true (decorative)
aria-label expander button Localized ‘Show all breadcrumbs’

No focus management except after expanding: focus moves to the first revealed item (made programmatically focusable when it is text), so focus never falls back to the document body.

Criterion Level Note
1.3.1 Info and Relationships A
2.1.1 Keyboard A
2.4.3 Focus Order A
2.4.4 Link Purpose (In Context) A
2.4.7 Focus Visible AA
2.4.8 Location AAA
4.1.2 Name, Role, Value A

Automated test results: Accessibility and compliance.

  • The ordered list conveys the number of levels and each item’s position.
  • Separators are decorative icons, not text characters, so they are not announced.
  • Manual screen-reader verification (NVDA, JAWS, VoiceOver) is pending.
Import cost Minified gzip brotli CSS brotli
@absoluteui/components/breadcrumb 33.3 kB 11.6 kB 10.3 kB 0.6 kB

Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.

Budget (enforced in CI) Limit
Breadcrumb.create with 10 items < 1 ms in headless Chromium

Tested scale: Trails of up to 6 items in the unit tests.

One click listener on the list and one configuration subscription per instance. Budget: under 1 ms for Breadcrumb.create with 10 items.

Measured run times: Performance.

States

default, hover, focus-visible, current page, collapsed, expanded.

State transitions
From Trigger To
collapsed expander activated expanded; focus on the first revealed item
expanded update({ items }) collapsed again when the new trail exceeds maxItems
any link click aui-navigate; native navigation unless prevented
Accessibility notes
  • The ordered list conveys the number of levels and each item’s position.
  • After expanding, focus moves to the first revealed item. A revealed text item gets tabindex="-1" so it can take focus.
  • Links are underlined, so they are not distinguished by color alone.
  • Manual screen-reader verification is pending (see Known limitations).
Responsive behavior

Items wrap onto multiple lines and long labels break anywhere. Set maxItems to collapse long trails, for example through global configuration on small screens.

Right-to-left

Layout follows the document direction. The chevron separator is mirrored when direction is 'rtl' or when the element is in an rtl context (:dir(rtl)).

Theming

Colors come from role tokens only. Verified in the light, dark, and high-contrast themes. In forced-colors mode links use LinkText and the expander gets a ButtonText border.

Global configuration
configureAbsoluteUI({ components: { breadcrumb: { maxItems: 4 } } });

Changes apply to existing instances immediately.

Component configuration

Instance options override global and theme defaults. All options are dynamic.

Icons

icons.separator (default chevron-right).

Security

Labels use textContent. Each href is parsed with the URL standard against document.baseURI. Only http:/https: URLs and scheme-less URLs (relative, path-absolute, protocol-relative, query, fragment) are accepted, so javascript:, data:, vbscript:, file:, mailto: and obfuscations such as java\tscript: throw BREADCRUMB_OPTIONS. The error names the property but never echoes the value. CSP-safe.

Data handling

No persistence, network access, or telemetry. Navigation is native link navigation unless aui-navigate is prevented.

Supported data scale

Trails of any practical depth; collapsing is recommended above about 5 items. Tested with trails of up to 6 items.

Edge cases
  • A single-item trail renders one current-page item and no separator.
  • maxItems: 2 shows the first item, the expander, and the current page.
  • maxItems: 1 is rejected, because it would hide the current page.
  • Items without href render as text, including in the middle of the trail.
  • With a file: base URL, relative hrefs are still accepted.
Errors
Code Category Cause
BREADCRUMB_OPTIONS configuration Empty items, an empty item label, an empty label, or an unsafe or unparsable href.
CFG_INVALID_VALUE configuration Invalid maxItems, locale, or direction.

A failed construction leaves no rendering, listeners, or subscriptions behind.

Known limitations
  • Collapsing is by item count, not by measured width.
  • An expanded trail stays expanded until the items change.
  • Screen-reader behavior has not yet been manually verified with NVDA, JAWS, and VoiceOver.
Unsupported scenarios
  • A dropdown menu of collapsed items (the expander reveals them in place).
  • HTML in labels.
  • Hrefs with schemes other than http and https.