🧭 Bootstrap 5 – Breadcrumbs: Navigate Hierarchies with Ease
🧲 Introduction – Why Use Breadcrumbs in Bootstrap 5?
Breadcrumbs are navigation elements that display a user’s path or location within a website. They improve usability, reduce bounce rate, and aid SEO by helping users understand site structure. In Bootstrap 5, breadcrumbs are easy to implement and style with built-in .breadcrumb
classes.
🎯 In this guide, you’ll learn:
- How to create semantic breadcrumb trails
- Style them using
.breadcrumb
and.breadcrumb-item
- Customize separators and accessibility
- Embed breadcrumbs into headers and sections
✅ Example 1 – Basic Breadcrumb
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item"><a href="#">Library</a></li>
<li class="breadcrumb-item active" aria-current="page">Data</li>
</ol>
</nav>
🔍 Explanation:
<nav aria-label="breadcrumb">
: Semantic wrapper for assistive tech<ol class="breadcrumb">
: Ordered list for breadcrumb trail.breadcrumb-item
: Applies Bootstrap spacing and display rules.active + aria-current="page"
: Marks current page for screen readers
✅ Example 2 – Breadcrumb Inside Page Header
<div class="container py-3">
<h4 class="mb-1">Dashboard</h4>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Dashboard</li>
</ol>
</nav>
</div>
🔍 Use Case:
- Ideal for admin panels, blogs, and product pages
- Positioned below a heading for UX consistency
✅ Example 3 – Custom Divider Between Breadcrumbs
<nav style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Store</a></li>
<li class="breadcrumb-item"><a href="#">Shoes</a></li>
<li class="breadcrumb-item active" aria-current="page">Sneakers</li>
</ol>
</nav>
🔍 Explanation:
- Bootstrap 5 uses
--bs-breadcrumb-divider
CSS variable - Replace
'/'
with any character like'>'
,'→'
,'•'
, etc.
✅ Example 4 – Breadcrumb With Custom Separator via CSS
<style>
.breadcrumb {
--bs-breadcrumb-divider: '→';
}
</style>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Shop</a></li>
<li class="breadcrumb-item"><a href="#">Men</a></li>
<li class="breadcrumb-item active" aria-current="page">Shirts</li>
</ol>
</nav>
🔍 Benefit:
- You can globally set separators using custom CSS
- Great for branding or multilingual designs
🛠️ Best Practices for Bootstrap 5 Breadcrumbs
Tip | Why It Helps |
---|---|
Always use aria-label="breadcrumb" | Improves screen reader support |
Use .active on last item only | Indicates current page clearly |
Customize separators for aesthetics | Matches brand or theme |
Combine with headings | Provides context and orientation to users |
Avoid over-nesting | Keep breadcrumbs clear and concise (2–5 levels max) |
📌 Summary – Bootstrap Breadcrumbs for Navigable UIs
Bootstrap 5 makes breadcrumbs simple, accessible, and customizable. Whether you’re building an e-commerce site, knowledge base, or dashboard, breadcrumbs enhance usability and user trust by showing the path clearly.
🔍 Key Takeaways:
- Use
.breadcrumb
with ordered lists for structured navigation - Customize separators with
--bs-breadcrumb-divider
- Apply
.active
andaria-current="page"
for accessibility - Combine breadcrumbs with headers for better UX flow
⚙️ Perfect for websites with multi-level content, category navigation, or search interfaces.
❓ FAQs – Bootstrap 5 Breadcrumbs
❓ Why use aria-label="breadcrumb"
in Bootstrap?
✅ It tells screen readers the list is for navigation, improving accessibility.
❓ How do I change the breadcrumb separator in Bootstrap 5?
✅ Use the CSS variable --bs-breadcrumb-divider
like this:
<nav style="--bs-breadcrumb-divider: '>';"></nav>
❓ Can I use icons in breadcrumbs?
✅ Yes. Embed SVGs or icon classes inside breadcrumb items:
<i class="bi bi-house"></i> Home
❓ Should the last breadcrumb item be a link?
❌ No. The final breadcrumb should use .active
and not be clickable.
Share Now :