UnflowUI
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

PropTypeDefaultDescription
itemsBreadcrumbItem[]—Required. The trail, from the root to the current page
size'sm' | 'md''sm'Text size
maxItemsnumber—Most items to show. Longer trails collapse the middle into a "More pages" menu. Values under 2 are treated as 2
linkComponentElementType'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:

FieldTypeDescription
labelstringRequired. Visible text, and the accessible name when hideLabel is set
hrefstringLink target
iconReactNodeIcon before the label
hideLabelbooleanShows only the icon
onClick(event?: MouseEvent<HTMLElement>) => voidCalled 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 PropPropsDescription
listBaseHTMLProps<HTMLOListElement>The <ol>
itemBaseHTMLProps<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-haspopup and aria-expanded. Escape closes the menu and returns focus to the button.