Breadcrumb

A page trail with one fluid hover across every crumb, dropdown steps, and collapsed middles.

Installation

This component is primitive-agnostic — same source under both flavors.

Basic

Inspect

The highlight is one element shared by the whole trail: move along the crumbs and it glides from one to the next instead of blinking off in the gaps. The last crumb is the current page and is announced with aria-current="page".

Separator and icon

Inspect

The separator lives inside each crumb, so the hover covers it and the crumbs sit flush. Pass separator={null} to remove it entirely.

Dropdown step

Inspect

A step with siblings can open a menu instead of navigating. While the menu is open the crumb keeps foreground text and its chevron points down; both states read from the props the primitive puts on the trigger.

Collapse the middle

Inspect

useBreadcrumbCollapse measures the trail and hides middle steps until it fits, keeping the first crumb, the last link and the current page. Give the Breadcrumb a bounded width — in a flex header, flex-1 min-w-0.

API Reference — Breadcrumb

PropTypeDefaultDescription
size"default" | "compact"from SizeProviderPins the trail to one size step. Default crumbs are 28px with 13px text; compact is 24px with 12px.
separatorReactNode | nullchevron-rightThe trailing glyph of every crumb but the last. null removes it; a custom glyph replaces the chevron.
aria-labelstring"Breadcrumb"Labels the navigation landmark.
...propsHTMLAttributes<HTMLElement>—Applied to the nav, which owns the trail's fluid hover scope.

API Reference — BreadcrumbLink

PropTypeDefaultDescription
hrefstring—The destination of the crumb.
renderReactElement—Renders a different element instead of <a>, such as a framework link.
asChildbooleanfalseshadcn-style composition: the single child element becomes the link.
...propsAnchorHTMLAttributes—All native anchor attributes. Long labels truncate at 12rem (10rem compact); pass max-w-* to change the cap.

API Reference — BreadcrumbButton

PropTypeDefaultDescription
type"button" | "submit" | "reset""button"Native button type.
...propsButtonHTMLAttributes—All native button attributes. Pass it to a DropdownTrigger's render prop to open a menu from a step.

useBreadcrumbCollapse

PropTypeDefaultDescription
countnumber—Total number of steps, including the current page.
enabledbooleantrueWhen false, nothing is hidden — for a trail the reader expanded.
listRefRef<HTMLOListElement>—Attach to BreadcrumbList. The hook measures it against its Breadcrumb.
hiddennumber—How many steps to hide, starting from the second. Render an ellipsis in their place.

Parts

PropTypeDefaultDescription
BreadcrumbListol—Lays the crumbs out in one row and holds the current page's truncation.
BreadcrumbItemli—Holds one crumb. Only the item with the current page is allowed to shrink.
BreadcrumbPagespan—The current page: foreground text, aria-current=page, and the one crumb that truncates.
BreadcrumbEllipsisspan—The collapsed middle. Put it in a named BreadcrumbButton.