Breadcrumbs v1.1.0
Provides a navigational trail that helps users understand their location within a website's hierarchy.
<nav aria-label="Breadcrumbs" class="breadcrumb">
<ol class="breadcrumb__list" role="list">
<li><a href="https://radancy.dev">Home</a></li>
<li><a href="#!">Subpage</a></li>
<li><a href="#!">Subpage</a></li>
<li><a href="#!">Subpage</a></li>
<li><a href="#content" aria-current="page">Breadcrumbs</a></li>
</ol>
</nav>/*!
Radancy Component Library: Breadcrumbs
Contributor(s):
Michael "Spell" Spellacy
Dependencies: Sass
*/
.breadcrumb {
--breadcrumb-color-track: #949595; // Track Color
--breadcrumb-color-thumb: #5D00C7; // Thumb Color
--breadcrumb-color-active: #3E0085; // Active State
padding: 1em 0;
&[data-scroll] {
overflow-x: auto;
// Fallback Scrollbar
scrollbar-color: var(--breadcrumb-color-thumb) var(--breadcrumb-color-track);
scrollbar-width: thin;
@supports #{"\selector(::-webkit-scrollbar)"} {
scrollbar-color: initial;
scrollbar-width: auto;
&::-webkit-scrollbar {
height: calc(8rem / 16);
}
&::-webkit-scrollbar-track, &::-webkit-scrollbar-thumb {
border-radius: 100vw;
}
&::-webkit-scrollbar-track {
background-color: var(--breadcrumb-color-track);
}
&::-webkit-scrollbar-thumb {
background-color: var(--breadcrumb-color-thumb);
&:hover {
background-color: var(--breadcrumb-color-active);
}
}
}
}
&__list {
display: flex;
flex-wrap: wrap;
list-style: none;
margin: 0;
padding: 0;
white-space: nowrap;
[data-scroll] & {
flex-wrap: nowrap;
}
li {
&:not(:last-child) {
&:after {
content: "\003E";
font-size: 1.1rem;
}
}
}
a {
display: inline-block;
line-height: normal;
outline-offset: -5px;
padding: 0.5em 1em;
&[aria-current] {
font-weight: bold;
text-decoration: none;
}
}
}
}Note: To test the scrollable area, resize the screen to a smaller width. When designing, ensure a partial item is visible at the edge to indicate scrollability and enhance usability.
<nav aria-label="Breadcrumbs" class="breadcrumb" data-scroll>
<ol class="breadcrumb__list" role="list">
<li><a href="https://radancy.dev">Home</a></li>
<li><a href="#!">Subpage</a></li>
<li><a href="#!">Subpage</a></li>
<li><a href="#!">Subpage</a></li>
<li><a href="#content" aria-current="page">Breadcrumbs</a></li>
</ol>
</nav>/*!
Radancy Component Library: Breadcrumbs
Contributor(s):
Michael "Spell" Spellacy
Dependencies: Sass
*/
.breadcrumb {
--breadcrumb-color-track: #949595; // Track Color
--breadcrumb-color-thumb: #5D00C7; // Thumb Color
--breadcrumb-color-active: #3E0085; // Active State
padding: 1em 0;
&[data-scroll] {
overflow-x: auto;
// Fallback Scrollbar
scrollbar-color: var(--breadcrumb-color-thumb) var(--breadcrumb-color-track);
scrollbar-width: thin;
@supports #{"\selector(::-webkit-scrollbar)"} {
scrollbar-color: initial;
scrollbar-width: auto;
&::-webkit-scrollbar {
height: calc(8rem / 16);
}
&::-webkit-scrollbar-track, &::-webkit-scrollbar-thumb {
border-radius: 100vw;
}
&::-webkit-scrollbar-track {
background-color: var(--breadcrumb-color-track);
}
&::-webkit-scrollbar-thumb {
background-color: var(--breadcrumb-color-thumb);
&:hover {
background-color: var(--breadcrumb-color-active);
}
}
}
}
&__list {
display: flex;
flex-wrap: wrap;
list-style: none;
margin: 0;
padding: 0;
white-space: nowrap;
[data-scroll] & {
flex-wrap: nowrap;
}
li {
&:not(:last-child) {
&:after {
content: "\003E";
font-size: 1.1rem;
}
}
}
a {
display: inline-block;
line-height: normal;
outline-offset: -5px;
padding: 0.5em 1em;
&[aria-current] {
font-weight: bold;
text-decoration: none;
}
}
}
}Scrollbars & Accessibility Anchor (Scrollbars & Accessibility)
Scrollbars can look and work differently depending on the operating system and browser, which is normal. If you choose to style scrollbars, keep in mind that not all browsers support the same options, so the look and feel may change. For example, Safari may hide scrollbars completely, which is expected. For accessibility, ensure the following:
- The scrubber, track, and background must each have a 3:1 contrast ratio with one another. For example, the scrubber must have a 3:1 contrast with the track, and the track must have a 3:1 contrast with the background beneath it. In some cases, it may be advisable to have the scrubber meet a 4.5:1 ratio with the track, for more solid usability.
- The hover state of the scrubber must meet a 3:1 contrast ratio with the track.
- The scrollbar must always include a 24px by 24px target area size. This isn't an issue for horizontal spacing on horizontal scrollbars, but be mindful of vertical spacing—if the scrollbar is too close to other interactive elements above or below it, it may be harder to use and will fail Target Size (Minimum) (Level AA). The opposite would be true on vertial scrollbars.
- There are no recommended dimensions for scrollbar scrubber height (horizontal) or width (vertical), but larger sizes would obviously be more noticeable and easier to use.
- While customizing scrollbars is permitted it is not generally recommended. Using native scrollbars is usually the most usable and accessible option. See Don't use custom CSS scrollbars for more details on why.
Properties Anchor (Properties)
Use the following properties to configure this component.
| ARIA | Applies To | Note | Description |
|---|---|---|---|
aria-current |
a |
Mandatory | Allows assistive technology users to know where they are within the site. The attribute must always be on the link of the page selected and must include a value of page. |
| Attribute | Applies To | Note | Description |
|---|---|---|---|
data-scroll |
.breadcrumb |
Boolean, Optional | Used to change the list into a scroll in smaller viewport sizes. |
| Class | Applies To | Note | Description |
|---|---|---|---|
.breadcrumb |
nav |
Mandatory | Used on the parent element that wraps your content. In this case, a nav element, which must always be used and be given a distinct accessible name. |
.breadcrumb__list |
ol |
Mandatory | Used on the element that wraps your list. Must be a child of .breadcrumb. |
Release Notes Anchor (Release Notes)
Keep up to date on major changes to this component.
- Feature
- Dynamically add
aria-currentto selected navigation item based on URL or page ID.
Report Issues
Find a bug? Want a new feature? Report it on JIRA. You're so awesome!