Skip to content

Breadcrumb

A hierarchical navigation trail that shows the user's location within a site or app.

  • stable
  • since v0.1.0
  • 2.5 kB
  • navigation
  • breadcrumb
  • accessible

Wraps items in a nav landmark with aria-label; the current page receives aria-current="page"; separators are role="presentation".

Preview
Open
tsx
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbPage,
} from "@arshad-shah/cynosure-react";
<Breadcrumb>
<BreadcrumbItem>
<BreadcrumbLink href="/">Home</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbItem>
<BreadcrumbLink href="/components">Components</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbItem isCurrent>
<BreadcrumbPage>Breadcrumb</BreadcrumbPage>
</BreadcrumbItem>
</Breadcrumb>

Separators are interleaved between BreadcrumbItem children automatically — you don’t need to add them yourself.

Pass a separator ReactNode to swap the default chevron for any glyph.

Preview
Open
tsx

Set maxItems to collapse the middle of a long trail into a BreadcrumbEllipsis. Tune which items stay visible at each end with itemsBeforeCollapse (default 1) and itemsAfterCollapse (default 2).

Preview
Open
tsx

BreadcrumbLink accepts any children, so an inline SVG renders alongside the label.

Preview
Open
tsx
PropTypeDefaultDescription
separator
ReactNode
Element rendered between items. Defaults to a small Lucide `ChevronRight` glyph.
maxItems
number
Collapse middle items when the total exceeds this count. Omit for an uncollapsed trail.
itemsBeforeCollapse
number
1
Items kept visible at the start of the trail when collapsing.
itemsAfterCollapse
number
2
Items kept visible at the end of the trail when collapsing.
renderCollapsed
((hiddenItems: ReactElement<unknown, string | JSXElementConstructor<any>>[]) => ReactNode)
Custom collapsed-items trigger. Defaults to a `BreadcrumbEllipsis` button — replace with e.g. a `DropdownMenu` listing the hidden links.
aria-label
string
"Breadcrumb"
Accessible label on the wrapping `<nav>`.
  • The root renders a <nav> with aria-label="Breadcrumb" (override via the aria-label prop).
  • Items render as <li> inside an <ol> so the trail order is exposed to assistive tech.
  • BreadcrumbItem carries aria-current="page" when isCurrent is set; BreadcrumbPage always carries aria-current="page".
  • Separators are <li role="presentation" aria-hidden="true"> so they don’t pollute the announcement.
  • The collapsed-items trigger is a real <button> (rendered via IconButton) with "Show more" as its default label.
  • Pair <BreadcrumbItem isCurrent> with <BreadcrumbPage> so both the <li> and the inner element announce the current page.
  • Use renderCollapsed to wire the ellipsis to a DropdownMenu listing the hidden links.
  • Lower maxItems (e.g. 3) on mobile breakpoints to shorten the trail.
  • Replace the default chevron with a / glyph for a more typographic look.