Skip to Content
Cristal

Navigation and progress

Breadcrumb

The path to the current page, as real links.

<cr-breadcrumb>CrBreadcrumb

Example

Write the levels as they are inside cr-breadcrumb: <a href> links (or your router's Link, which renders an <a>), then the current page last, in a <span>. The links stay yours, in the page: Ctrl/Cmd+click, middle click and "Open in new tab" are the browser's own. Chevrons separate the levels.

Beyond max levels (4 by default), the middle ones collapse behind a "…" button: only the first one and the last max - 2 stay visible. Clicking "…" reveals the hidden levels, which slide out of it one after the other.

import { CrBox, CrBreadcrumb } from '@cristal-ui/react';

export default function BreadcrumbBasic() {
  return (
    <CrBox display="flex" direction="column" gap="lg">
      <CrBreadcrumb>
        <a href="/docs">Home</a>
        <a href="/docs/composants/bouton">Components</a>
        <span>Breadcrumb</span>
      </CrBreadcrumb>
      <CrBreadcrumb>
        <a href="/docs">Home</a>
        <a href="/docs">Shop</a>
        <a href="/docs">Home and garden</a>
        <a href="/docs">Kitchen</a>
        <a href="/docs">Utensils</a>
        <span>Steel whisk</span>
      </CrBreadcrumb>
    </CrBox>
  );
}

If the user asked their system to reduce motion, the revealed levels appear at once, without sliding.

Accessibility

  • The breadcrumb is a navigation region (nav) named "Breadcrumb", with an ordered list: one list item per level.
  • The last level gets aria-current="page"; it also stands out without colour, since it is not a link (no underline).
  • Separators are drawn in CSS, without text: screen readers do not read them.
  • The "…" button is named by what it does ("Show 3 hidden levels") and has aria-expanded. Once the levels are revealed, it goes away and focus moves to the first revealed link.

API

Properties

PropertyTypeDefaultDescription
maxnumber4Nombre de niveaux au-delà duquel ceux du milieu se replient (le premier et les max - 2 derniers restent visibles).

Slots

SlotDescription
defaultLes niveaux : des liens, puis la page courante.

CSS parts

To style it from outside: cr-breadcrumb::part(name) { … }

PartDescription
moreLe bouton « … » qui déplie les niveaux masqués.

On this page