Breadcrumb

Shows the path from the app root to the current page.

Import

import { Breadcrumb } from '@matix/components/breadcrumb';

Usage

Pass your router link to render. Breadcrumb.Link puts its styles and props on that element, so the page gets one <a>, not two nested anchors. This is the same render prop that the Base UI components use.

import Link from 'next/link';

<Breadcrumb.Item>
  <Breadcrumb.Link render={<Link href="/components" />}>Components</Breadcrumb.Link>
</Breadcrumb.Item>;

asChild still works, but it is deprecated. Use render.

Custom Separator

Pass any node as children of Breadcrumb.Separator to replace the default chevron.

Collapsed

Render a Breadcrumb.Ellipsis in place of intermediate items when the path is long. Wrap it in a Menu.Trigger to expose the hidden items on click.

To open the hidden items in a menu, the trigger needs its own name:

<Breadcrumb.Item>
  <Menu.Root>
    <Menu.Trigger render={<Button variant="ghost" size="sm" aria-label="Show hidden pages" />}>
      <Breadcrumb.Ellipsis />
    </Menu.Trigger>
    {/* Menu.Portal with one Menu.Item per hidden page */}
  </Menu.Root>
</Breadcrumb.Item>

Custom Styles

import * as stylex from '@stylexjs/stylex';

const custom = stylex.create({
  link: { color: '#3b82f6', fontWeight: 500 },
});

<Breadcrumb>
  <Breadcrumb.List>
    <Breadcrumb.Item>
      <Breadcrumb.Link href="/" sx={custom.link}>
        Home
      </Breadcrumb.Link>
    </Breadcrumb.Item>
    <Breadcrumb.Separator />
    <Breadcrumb.Item>
      <Breadcrumb.Page>Current</Breadcrumb.Page>
    </Breadcrumb.Item>
  </Breadcrumb.List>
</Breadcrumb>;

API Reference

ComponentPropTypeDefaultDescription
BreadcrumbsxStyleXStyles—StyleX override for the root <nav>
Breadcrumb.ListsxStyleXStyles—StyleX override for the <ol>
Breadcrumb.ItemsxStyleXStyles—StyleX override for the <li>
Breadcrumb.Linkhrefstring—Href for the anchor
Breadcrumb.LinkrenderReactElement | (props) => ReactElement—Element to render in place of the <a>, e.g. Next.js <Link href="/x" />
Breadcrumb.LinkasChildbooleanfalseDeprecated. Use render. Merges styles onto the single child element
Breadcrumb.LinksxStyleXStyles—StyleX override
Breadcrumb.PagesxStyleXStyles—StyleX override for the current-page <span>
Breadcrumb.SeparatorchildrenReactNode—Custom separator (defaults to chevron)
Breadcrumb.SeparatorsxStyleXStyles—StyleX override
Breadcrumb.EllipsischildrenReactNode—Custom content (defaults to three dots)
Breadcrumb.EllipsissxStyleXStyles—StyleX override

All other HTML attributes on each sub-component are forwarded.

Accessibility

  • The root <nav> is labeled aria-label="breadcrumb".
  • The current page uses aria-current="page" on a non-interactive <span>.
  • Separators are marked aria-hidden="true" and role="presentation" so screen readers skip them.
  • Ellipsis is decorative (aria-hidden). When you wrap it in a Menu.Trigger, give the trigger an aria-label, for example aria-label="Show hidden pages". Without it the trigger has no accessible name.
  • The list is a semantic <ol> so assistive tech announces ordered steps.

Keyboard

KeyAction
TabMoves focus to the next link
Shift + TabMoves focus to the previous link
EnterFollows the focused link