Skip to content

Breadcrumb ​

Shows where the current page sits in the site hierarchy, with links to each parent.

Installation ​

bash
npx bootcn add breadcrumb
bash
pnpm dlx bootcn add breadcrumb
bash
yarn dlx bootcn add breadcrumb
bash
bunx --bun bootcn add breadcrumb

The CLI also installs the design tokens and these components: none. It prints the <link> and <script> tags to add to your layout.

Usage ​

List the parents in order and make the last item the current page, without a link and with aria-current="page". Change the separator with --bs-breadcrumb-divider (a quoted string, for example '/').

Accessibility ​

  • A <nav aria-label="Breadcrumb"> landmark around an ordered list.
  • The separator is CSS content, so screen readers do not read it.

Dependencies ​

  • Bootstrap 5.3+ CSS.
  • themes/tokens/tokens.css.

Source ​

The exact files the CLI installs (breadcrumb@1.0.0). View on GitHub · Report an issue

html
<nav aria-label="Breadcrumb">
  <ol class="breadcrumb bootcn-breadcrumb">
    <li class="breadcrumb-item"><a href="#">Home</a></li>
    <li class="breadcrumb-item"><a href="#">Components</a></li>
    <li class="breadcrumb-item active" aria-current="page">Breadcrumb</li>
  </ol>
</nav>
css
.bootcn-breadcrumb {
  --bs-breadcrumb-divider: '›';
  --bs-breadcrumb-divider-color: var(--bootcn-muted-foreground);
  --bs-breadcrumb-item-active-color: var(--bootcn-foreground);
  --bs-breadcrumb-item-padding-x: 0.5rem;
  --bs-breadcrumb-margin-bottom: 0;

  flex-wrap: wrap;
  font-size: 0.875rem;
}

.bootcn-breadcrumb a {
  color: var(--bootcn-muted-foreground);
  text-decoration: none;
  transition: color var(--bootcn-transition);
}

.bootcn-breadcrumb a:hover {
  color: var(--bootcn-foreground);
  text-decoration: underline;
}

.bootcn-breadcrumb a:focus-visible {
  border-radius: var(--bootcn-radius-sm);
  outline: 0;
  box-shadow: var(--bootcn-focus-ring);
}

Released under the MIT License. Not affiliated with Bootstrap or shadcn/ui.