1 |
efrain |
1 |
---
|
|
|
2 |
layout: docs
|
|
|
3 |
title: Breadcrumb
|
|
|
4 |
description: Indicate the current page's location within a navigational hierarchy that automatically adds separators via CSS.
|
|
|
5 |
group: components
|
|
|
6 |
---
|
|
|
7 |
|
|
|
8 |
## Example
|
|
|
9 |
|
|
|
10 |
{{< example >}}
|
|
|
11 |
<nav aria-label="breadcrumb">
|
|
|
12 |
<ol class="breadcrumb">
|
|
|
13 |
<li class="breadcrumb-item active" aria-current="page">Home</li>
|
|
|
14 |
</ol>
|
|
|
15 |
</nav>
|
|
|
16 |
|
|
|
17 |
<nav aria-label="breadcrumb">
|
|
|
18 |
<ol class="breadcrumb">
|
|
|
19 |
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
|
|
20 |
<li class="breadcrumb-item active" aria-current="page">Library</li>
|
|
|
21 |
</ol>
|
|
|
22 |
</nav>
|
|
|
23 |
|
|
|
24 |
<nav aria-label="breadcrumb">
|
|
|
25 |
<ol class="breadcrumb">
|
|
|
26 |
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
|
|
27 |
<li class="breadcrumb-item"><a href="#">Library</a></li>
|
|
|
28 |
<li class="breadcrumb-item active" aria-current="page">Data</li>
|
|
|
29 |
</ol>
|
|
|
30 |
</nav>
|
|
|
31 |
{{< /example >}}
|
|
|
32 |
|
|
|
33 |
## Changing the separator
|
|
|
34 |
|
|
|
35 |
Separators are automatically added in CSS through [`::before`](https://developer.mozilla.org/en-US/docs/Web/CSS/::before) and [`content`](https://developer.mozilla.org/en-US/docs/Web/CSS/content). They can be changed by changing `$breadcrumb-divider`. The [quote](https://sass-lang.com/documentation/modules/string#quote) function is needed to generate the quotes around a string, so if you want `>` as separator, you can use this:
|
|
|
36 |
|
|
|
37 |
```scss
|
|
|
38 |
$breadcrumb-divider: quote(">");
|
|
|
39 |
```
|
|
|
40 |
|
|
|
41 |
It's also possible to use a **base64 embedded SVG icon**:
|
|
|
42 |
|
|
|
43 |
```scss
|
|
|
44 |
$breadcrumb-divider: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4IiBoZWlnaHQ9IjgiPjxwYXRoIGQ9Ik0yLjUgMEwxIDEuNSAzLjUgNCAxIDYuNSAyLjUgOGw0LTQtNC00eiIgZmlsbD0iY3VycmVudENvbG9yIi8+PC9zdmc+);
|
|
|
45 |
```
|
|
|
46 |
|
|
|
47 |
The separator can be removed by setting `$breadcrumb-divider` to `none`:
|
|
|
48 |
|
|
|
49 |
```scss
|
|
|
50 |
$breadcrumb-divider: none;
|
|
|
51 |
```
|
|
|
52 |
|
|
|
53 |
## Accessibility
|
|
|
54 |
|
|
|
55 |
Since breadcrumbs provide a navigation, it's a good idea to add a meaningful label such as `aria-label="breadcrumb"` to describe the type of navigation provided in the `<nav>` element, as well as applying an `aria-current="page"` to the last item of the set to indicate that it represents the current page.
|
|
|
56 |
|
|
|
57 |
For more information, see the [ARIA Authoring Practices Guide breadcrumb pattern](https://www.w3.org/WAI/ARIA/apg/patterns/breadcrumb/).
|