Breadcrumb
Shows where the current page sits in the site hierarchy, with links to each parent.
- Version 1.0.0
- Bootstrap 5.3+
- Requires Bootstrap CSS
- Source on GitHub
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>Installation
bash
npx bootcn add breadcrumbbash
pnpm dlx bootcn add breadcrumbbash
yarn dlx bootcn add breadcrumbbash
bunx --bun bootcn add breadcrumbThe CLI also installs the design tokens and these components: none. It prints the <link> and <script> tags to add to your layout.
- Load Bootstrap 5.3 (Bootstrap CSS) and the design tokens.
- Install the components it uses: none.
- Copy the files from Source into your project. With the default
bootcn.jsonthey go here:
| File | Default location |
|---|---|
breadcrumb.html | components/ui/breadcrumb.html |
breadcrumb.css | assets/css/breadcrumb.css |
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);
}
