Breadcrumb
Show where a page sits in a hierarchy, with direct navigation back to each parent level.
import { Breadcrumb } from '@uthereal/ui/breadcrumb'Breadcrumb playground
Overview
Breadcrumb renders the ordered path from the top level to the current page. Earlier items render as links (href), action buttons (action), or plain text; the last item is always the current page (aria-current="page"). Each label reserves the width of its weight-500 text so becoming the current page never shifts the trail. When the path exceeds maxItems, the middle levels collapse behind a … button that opens a dropdown menu.
Use Breadcrumb above a page title in nested hierarchies, such as a document inside a folder inside a project. Use Tabs to switch between sibling views on the same page.
| Item shape | Element rendered | Behavior |
|---|---|---|
Last item in items | <span aria-current="page"> | Strong accent at weight 500; href and action are ignored. |
Earlier item with href | <a> (or renderLink) | Secondary text; turns strong accent with a soft underline on hover/press. |
Earlier item with action | <button type="button"> | Calls onAction(action, id) for state-driven paths without URLs. |
Earlier item without href/action | <span> | Muted plain text; shown disabled if collapsed into the menu. |
Usage
'use client'
import { Breadcrumb } from '@uthereal/ui/breadcrumb'
export function DocumentPath({ openFolder }: { openFolder: () => void }) {
return (
<Breadcrumb
items={[
{ id: 'projects', label: 'Projects', href: '/projects' },
{ id: 'acme', label: 'Acme redesign', href: '/projects/acme' },
{ id: 'files', label: 'Files', action: 'open_files' },
{ id: 'brief', label: 'Brief.pdf' },
]}
onAction={(action) => {
if (action === 'open_files') openFolder()
}}
/>
)
}onAction receives the item's action name and id. Pass maxItems (2 to 10; default 10) to collapse long paths automatically.
Examples
Use <SchemaPlayground /> above to test recipe, theme, motion, tooltip, tooltipPlacement, and dir. The examples below show distinct separator styles, path collapsing, and action-driven trails.
Slash separator
Switch from the default chevron separator shown in the playground to slash. Both separators are decorative and hidden from assistive technology; the chevron mirrors automatically in right-to-left layouts.
Collapsed path
When items.length exceeds maxItems, the first item and the last maxItems − 1 items remain visible, and the … button opens the hidden middle levels (including their icons) in a dropdown menu. Choosing a collapsed link calls onNavigate(href, id), or falls back to browser navigation when omitted; choosing a collapsed action calls onAction(action, id).
Actions
Items with action render as native buttons for paths that live in application state rather than URLs, such as a drill-down inside a panel.
Routing
Visible links render a plain <a>. Pass renderLink to integrate your router's link component, and onNavigate to route collapsed links selected from the … menu:
import Link from 'next/link'
import { useRouter } from 'next/navigation'
const router = useRouter()
<Breadcrumb
items={items}
renderLink={(props) => <Link {...props} />}
onNavigate={(href) => router.push(href)}
/>API reference
Serializable arguments and defaults come directly from breadcrumbConfigSchema.
| Argument | Type / default | Description |
|---|---|---|
label | stringDefault: "Breadcrumb" | Accessible name of the navigation landmark. Not shown. |
itemsRequired | BreadcrumbItem[]— | The path in order, ending with the current page. Each item has a stable ID, a label, and an optional href or action (not both) and icon. |
maxItems | integerDefault: 10 | Most items shown at once (10, so by default nothing collapses, as in Arc). When there are more, the first item and the last maxItems − 1 stay, and the middle opens from a "…" button. |
separator | chevron | slashDefault: "chevron" | Mark between items: a chevron, or a slash. |
moreLabel | stringDefault: "Show more pages" | Accessible name of the "…" button that opens the collapsed items. |
tooltip | booleanDefault: true | Show moreLabel in a tooltip on the "…" button on hover and keyboard focus. |
tooltipPlacement | PlacementDefault: "top" | Preferred side of the tooltip. Collision detection flips it when there is no room. |
recipe | studio | softDefault: "studio" | Visual treatment. Both recipes use the same interaction behavior. |
theme | BreadcrumbTheme— | Color mode, accent, and semantic tokens. See Theming for all keys and defaults. |
motion | none | subtle | expressiveDefault: "subtle" | Animation preset for path updates, hover transitions, and the collapsed menu. System reduced-motion preferences take precedence. |
dir | ltr | rtl— | Reading direction; the path runs from the right and chevrons mirror in RTL. Omit it to inherit the page direction. |
The module also exports collapseItems and resolveBreadcrumbMotion helpers alongside BreadcrumbIconSlot ('icon' | 'separator' | 'more').
Breadcrumb item fields (BreadcrumbItem)
| Field | Type | Purpose |
|---|---|---|
id | string | Stable unique ID, reported with onAction and onNavigate. |
label | string | Visible page or place name. |
href | string | Optional navigation URL (http(s), mailto, or relative); mutually exclusive with action. |
action | string | Optional host-registered snake_case action name; mutually exclusive with href. |
icon | IconName | Optional decorative icon before the label (preserved in the collapsed menu). |
React integration
| Prop | Purpose |
|---|---|
onAction(action, itemId) | Handle an item's action, both inline and from the collapsed menu. |
renderLink(props, item) | Render a custom router link. Spread props (href, className, children). |
onNavigate(href, itemId) | Route a collapsed link selected from the menu; falls back to window.location.assign. |
renderIcon(name, context) | Replace decorative icons; context provides size and slot ("icon", "separator", or "more"). |
preset | Application defaults overridden by explicit instance props. |
tokens | --ui-* CSS variables applied after the typed theme on the root, menu, and tooltip. |
ref, className, style | Applied to the root <nav> element, which carries the theme tokens. |
| Native attributes | id, aria-*, data-*, and remaining <nav> attributes forwarded to the root. |
Keyboard & accessibility
| Key | Interaction |
|---|---|
Tab | Move focus through links, action buttons, and the … menu trigger. |
Enter | Follow a link, trigger an action, or open the collapsed menu. |
Space | Trigger an action button or open the collapsed menu. |
Arrow keys, Home, End | Navigate inside the collapsed menu; Escape closes it and returns focus to …. |
Breadcrumb renders a <nav> landmark named by label containing an ordered list (<ol>). The last item carries aria-current="page" and weight 500 so the active location never relies on color alone. The … button is named by moreLabel and shows a non-redundant visual tooltip (describeTrigger={false}) when tooltip is true.
In RTL (dir="rtl"), logical CSS properties, chevron separators, slide direction, and the collapsed menu mirror automatically. Under forced-colors: active, links use LinkText, action buttons and the … button use ButtonText, and keyboard focus rings use Highlight.
Motion and theming
Items present on the first render stay still. In subtle (default, Arc), added crumbs slide 8 px from the path start through a 2 px blur over 240 ms (enter curve), sibling items reflow on the smooth spring (0.4 s, bounce 0), and removed crumbs exit 4 px over 120 ms (standard curve). expressive uses 12 px / 6 px travel and the morph spring (0.42 s, bounce 0.16). Links, current text, and the … trigger ease state colors over 160 ms, and the collapsed menu uses dropdown popup motion.
Setting motion="none" makes path updates, state colors, and the collapsed menu immediate (0 ms). System prefers-reduced-motion: reduce disables travel, blur, layout springs, and CSS state transitions while keeping a 120 ms opacity crossfade on path changes and the collapsed menu.
theme accepts mode, accent, and tokens from the core group (fontSize sets text size) plus iconSize, borderStrong (separators), and accentStrong (hover and current page). The collapsed menu and tooltip inherit recipe, theme mode/accent, and tokens. Supply application-wide defaults with UtherealProvider.
Composition
In agent compositions, Breadcrumb is a leaf. Every item action must match a host-registered action; the host handler receives { componentId, itemId }. See Building with agents.
{
"type": "Breadcrumb",
"props": {
"items": [
{ "id": "cases", "label": "Cases", "action": "open_cases" },
{ "id": "acme", "label": "Acme v. Beta" }
]
},
"children": []
}