Breadcrumb
Importing
Add rh-breadcrumb to your page with this import statement:
<script type="module">
import '@rhds/elements/rh-breadcrumb/rh-breadcrumb.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
To learn more about installing RHDS elements on your site using an import map read our getting started docs.
Lightdom CSS
This element requires you to load "Lightdom CSS" stylesheets for styling deeply slotted elements.
Note
Replace /path/to/ with path to the CSS file, whether local or CDN.
<link rel="stylesheet" href="/path/to/rh-breadcrumb/rh-breadcrumb-lightdom.css">
Usage
<rh-breadcrumb>
<ol>
<li><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Red Hat OpenShift on AWS</a></li>
<li><a href="#">4</a></li>
<li><a href="#">Introduction to ROSA</a></li>
<li><a href="#" aria-current="page">Chapter 1. Understanding ROSA</a></li>
</ol>
</rh-breadcrumb>
<link rel="stylesheet" href="../rh-breadcrumb-lightdom.css">
<script type="module">
import '@rhds/elements/rh-breadcrumb/rh-breadcrumb.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
rh-breadcrumb
A breadcrumb provides secondary navigation for showing the user's
hierarchical location within a site. Users must slot an <ol> with
<li> items containing <a> links. The last item should carry
aria-current="page" so screen readers announce the current page.
Keyboard users navigate breadcrumb links with Tab and activate
them with Enter.
Theming
This element uses Red Hat design system theming and can be used in themable contexts.
Slots
1
| Slot Name | Summary | Description |
|---|---|---|
Expects a single |
Each |
Attributes
3
| Attribute | DOM Property | Description | Type | Default |
|---|---|---|---|---|
|
|
accessibleLabel |
Customizes the |
|
|
|
|
variant |
Sets the visual variant for the breadcrumb. The |
|
|
|
|
truncate |
When true, breadcrumb lists with five or more items are truncated: middle items are hidden and replaced by an ellipsis button that users can activate to reveal the full trail. Lists with fewer than five items are not affected. The truncation button is keyboard-accessible and announces its purpose to screen readers. |
|
|
Methods
1
| Method Name | Description |
|---|---|
|
|
After first render, applies truncation when the |
Events
0
None
CSS Shadow Parts
1
| Part Name | Summary | Description |
|---|---|---|
|
|
nav landmark with aria-label for assistive technology |
CSS Custom Properties
3
| CSS Property | Description | Default |
|---|---|---|
--rh-breadcrumb-caret-image |
The |
{svg encoded as data URI}
|
--rh-breadcrumb-li-padding-inline-end |
Inline-end spacing per item; defaults to the |
var(--rh-space-lg, 16px)
|
--rh-breadcrumb-link-color |
Link color for anchors; defaults to the
|
var(--rh-color-interactive-primary-default)
|
Design Tokens
0
None
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.