Breadcrumb
A navigation breadcrumb component with collapsible items, custom separators, and accessible markup.
Basic Usage
Standard Breadcrumb
A simple breadcrumb trail with the last item as the current page.
import { Breadcrumb } from 'fluxo-ui';
import type { BreadcrumbItem } from 'fluxo-ui';
const items: BreadcrumbItem[] = [
{ label: 'Home', href: '/' },
{ label: 'Products', href: '/products' },
{ label: 'Electronics', href: '/products/electronics' },
{ label: 'Laptops' },
];
<Breadcrumb
items={items}
onItemClick={(item, index) => console.log(item.label, index)}
/>Collapsed Items
Set maxItems to collapse middle items into an ellipsis that expands into a dropdown on click.
Collapsed Items
When maxItems is set, middle items collapse into an ellipsis dropdown. Click the ellipsis to expand.
import { Breadcrumb } from 'fluxo-ui';
const items = [
{ label: 'Home', href: '/' },
{ label: 'Region', href: '/region' },
{ label: 'Country', href: '/country' },
{ label: 'State', href: '/state' },
{ label: 'City', href: '/city' },
{ label: 'District', href: '/district' },
{ label: 'Street' },
];
<Breadcrumb items={items} maxItems={3} />Custom Separator
Use the separator prop to customize the divider between breadcrumb items.
Custom Separators
Use any ReactNode as a separator between breadcrumb items.
import { Breadcrumb } from 'fluxo-ui';
const arrowSeparator = (
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />
</svg>
);
<Breadcrumb items={items} separator={arrowSeparator} />
<Breadcrumb items={items} separator=">" />
<Breadcrumb items={items} separator="|" />Import
import { Breadcrumb } from 'fluxo-ui';
import type { BreadcrumbItem, BreadcrumbProps } from 'fluxo-ui';Breadcrumb Props
itemsreqBreadcrumbItem[]Array of breadcrumb items to display.
itemsreqBreadcrumbItem[]Array of breadcrumb items to display.
separatorReactNode"'/'"Custom separator between items.
separatorReactNode"'/'"Custom separator between items.
maxItemsnumberMaximum visible items before collapsing middle items into ellipsis. When omitted, the breadcrumb auto-collapses based on container width unless autoCollapse is explicitly false.
maxItemsnumberMaximum visible items before collapsing middle items into ellipsis. When omitted, the breadcrumb auto-collapses based on container width unless autoCollapse is explicitly false.
autoCollapseboolean"true"Auto-collapse middle items when the breadcrumb overflows its container. Ignored when maxItems is provided.
autoCollapseboolean"true"Auto-collapse middle items when the breadcrumb overflows its container. Ignored when maxItems is provided.
classNamestringAdditional CSS class for the nav container.
classNamestringAdditional CSS class for the nav container.
onItemClick(item: BreadcrumbItem, index: number) => voidCalled when any breadcrumb item is clicked.
onItemClick(item: BreadcrumbItem, index: number) => voidCalled when any breadcrumb item is clicked.
BreadcrumbItem Interface
labelreqstringDisplay text for the breadcrumb.
labelreqstringDisplay text for the breadcrumb.
hrefstringURL for the breadcrumb link.
hrefstringURL for the breadcrumb link.
iconReactNodeIcon displayed before the label.
iconReactNodeIcon displayed before the label.
onClick() => voidClick handler for the item.
onClick() => voidClick handler for the item.
Features
Auto Collapse
Long breadcrumb trails collapse middle items into an expandable ellipsis menu.
Custom Separators
Use any ReactNode as a separator: text, icons, or custom elements.
Link & Button Modes
Items render as anchor tags (with href) or buttons (with onClick).
Active Page
The last item is automatically styled as the current page with aria-current.
Icon Support
Each item can display an icon alongside its label.
Accessibility
Semantic nav/ol markup with aria-label and aria-current attributes.