Components
Breadcrumb
The trail of pages above the current one, with a More pages menu for long trails and router link support.
Overview
Breadcrumb shows where the current page sits. The last item is the current page and is never a link. With maxItems, a long trail keeps the first item and the last maxItems - 1 items, and collapses the middle into a "More pages" menu.
The first item can show only its icon (hideLabel), e.g. a home icon; its label stays as the accessible name.
Import
import { Breadcrumb } from '@unflowio/ui/components/Breadcrumb';collapseBreadcrumb(items, maxItems) is also exported, for building a custom trail with the same collapsing rule.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | BreadcrumbItem[] | — | Required. The trail, from the root to the current page |
size | 'sm' | 'md' | 'sm' | Text size |
maxItems | number | — | Most items to show. Longer trails collapse the middle into a "More pages" menu. Values under 2 are treated as 2 |
linkComponent | ElementType | 'a' | Renders links, e.g. next/link. Receives href, className and children |
onNavigate | (href: string) => void | — | Called when a collapsed item with an href is picked from the menu, so a client router can navigate. Without it the browser navigates to the href |
BreadcrumbItem:
| Field | Type | Description |
|---|---|---|
label | string | Required. Visible text, and the accessible name when hideLabel is set |
href | string | Link target |
icon | ReactNode | Icon before the label |
hideLabel | boolean | Shows only the icon |
onClick | (event?: MouseEvent<HTMLElement>) => void | Called on click. Items picked from the menu call it without an event |
Basic usage
<Breadcrumb
items={[
{ label: 'Home', href: '/', icon: <House />, hideLabel: true },
{ label: 'Projects', href: '/projects' },
{ label: 'Hero image' },
]}
/>Sizes
Collapsed
const router = useRouter();
<Breadcrumb items={trail} maxItems={3} linkComponent={Link} onNavigate={router.push} />Customization (slotProps)
| Slot Prop | Props | Description |
|---|---|---|
list | BaseHTMLProps<HTMLOListElement> | The <ol> |
item | BaseHTMLProps<HTMLLIElement> | Each <li> |
Accessibility
- The trail is a
<nav>landmark named "Breadcrumb" (translated) around an ordered list. Separators are hidden from assistive technology. - The current page has
aria-current="page". - The "More pages" button has
aria-haspopupandaria-expanded. Escape closes the menu and returns focus to the button.