Debian Codegraph @

node/@patternfly/patternfly/docs/components/Breadcrumb/examples/Breadcrumb.md

raw
1 ---
2 id: Breadcrumb
3 section: components
4 cssPrefix: pf-v6-c-breadcrumb
5 ---## Examples
6
7 ### Basic
8
9 ```html
10 <nav class="pf-v6-c-breadcrumb" aria-label="breadcrumb">
11 <ol class="pf-v6-c-breadcrumb__list" role="list">
12 <li class="pf-v6-c-breadcrumb__item">
13 <span class="pf-v6-c-breadcrumb__item-divider">
14 <svg
15 class="pf-v6-svg"
16 fill="currentColor"
17 viewBox="0 0 20 20"
18 aria-hidden="true"
19 role="img"
20 width="1em"
21 height="1em"
22 >
23 <path
24 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
25 />
26 </svg>
27 </span>
28 <a href="#" class="pf-v6-c-breadcrumb__link">Section home</a>
29 </li>
30 <li class="pf-v6-c-breadcrumb__item">
31 <span class="pf-v6-c-breadcrumb__item-divider">
32 <svg
33 class="pf-v6-svg"
34 fill="currentColor"
35 viewBox="0 0 20 20"
36 aria-hidden="true"
37 role="img"
38 width="1em"
39 height="1em"
40 >
41 <path
42 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
43 />
44 </svg>
45 </span>
46 <a href="#" class="pf-v6-c-breadcrumb__link">Section title</a>
47 </li>
48 <li class="pf-v6-c-breadcrumb__item">
49 <span class="pf-v6-c-breadcrumb__item-divider">
50 <svg
51 class="pf-v6-svg"
52 fill="currentColor"
53 viewBox="0 0 20 20"
54 aria-hidden="true"
55 role="img"
56 width="1em"
57 height="1em"
58 >
59 <path
60 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
61 />
62 </svg>
63 </span>
64 <a href="#" class="pf-v6-c-breadcrumb__link">Section title</a>
65 </li>
66 <li class="pf-v6-c-breadcrumb__item">
67 <span class="pf-v6-c-breadcrumb__item-divider">
68 <svg
69 class="pf-v6-svg"
70 fill="currentColor"
71 viewBox="0 0 20 20"
72 aria-hidden="true"
73 role="img"
74 width="1em"
75 height="1em"
76 >
77 <path
78 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
79 />
80 </svg>
81 </span>
82 <a
83 href="#"
84 class="pf-v6-c-breadcrumb__link pf-m-current"
85 aria-current="page"
86 >Section landing</a>
87 </li>
88 </ol>
89 </nav>
90
91 ```
92
93 ### Without home link
94
95 ```html
96 <nav class="pf-v6-c-breadcrumb" aria-label="breadcrumb">
97 <ol class="pf-v6-c-breadcrumb__list" role="list">
98 <li class="pf-v6-c-breadcrumb__item">
99 <span class="pf-v6-c-breadcrumb__item-divider">
100 <svg
101 class="pf-v6-svg"
102 fill="currentColor"
103 viewBox="0 0 20 20"
104 aria-hidden="true"
105 role="img"
106 width="1em"
107 height="1em"
108 >
109 <path
110 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
111 />
112 </svg>
113 </span>
114 Section home
115 </li>
116 <li class="pf-v6-c-breadcrumb__item">
117 <span class="pf-v6-c-breadcrumb__item-divider">
118 <svg
119 class="pf-v6-svg"
120 fill="currentColor"
121 viewBox="0 0 20 20"
122 aria-hidden="true"
123 role="img"
124 width="1em"
125 height="1em"
126 >
127 <path
128 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
129 />
130 </svg>
131 </span>
132 <a href="#" class="pf-v6-c-breadcrumb__link">Section title</a>
133 </li>
134 <li class="pf-v6-c-breadcrumb__item">
135 <span class="pf-v6-c-breadcrumb__item-divider">
136 <svg
137 class="pf-v6-svg"
138 fill="currentColor"
139 viewBox="0 0 20 20"
140 aria-hidden="true"
141 role="img"
142 width="1em"
143 height="1em"
144 >
145 <path
146 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
147 />
148 </svg>
149 </span>
150 <a href="#" class="pf-v6-c-breadcrumb__link">Section title</a>
151 </li>
152 <li class="pf-v6-c-breadcrumb__item">
153 <span class="pf-v6-c-breadcrumb__item-divider">
154 <svg
155 class="pf-v6-svg"
156 fill="currentColor"
157 viewBox="0 0 20 20"
158 aria-hidden="true"
159 role="img"
160 width="1em"
161 height="1em"
162 >
163 <path
164 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
165 />
166 </svg>
167 </span>
168 <a href="#" class="pf-v6-c-breadcrumb__link">Section title</a>
169 </li>
170 <li class="pf-v6-c-breadcrumb__item">
171 <span class="pf-v6-c-breadcrumb__item-divider">
172 <svg
173 class="pf-v6-svg"
174 fill="currentColor"
175 viewBox="0 0 20 20"
176 aria-hidden="true"
177 role="img"
178 width="1em"
179 height="1em"
180 >
181 <path
182 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
183 />
184 </svg>
185 </span>
186 <a href="#" class="pf-v6-c-breadcrumb__link">Section title</a>
187 </li>
188 <li class="pf-v6-c-breadcrumb__item">
189 <span class="pf-v6-c-breadcrumb__item-divider">
190 <svg
191 class="pf-v6-svg"
192 fill="currentColor"
193 viewBox="0 0 20 20"
194 aria-hidden="true"
195 role="img"
196 width="1em"
197 height="1em"
198 >
199 <path
200 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
201 />
202 </svg>
203 </span>
204 <a
205 href="#"
206 class="pf-v6-c-breadcrumb__link pf-m-current"
207 aria-current="page"
208 >Section landing</a>
209 </li>
210 </ol>
211 </nav>
212
213 ```
214
215 ### With heading
216
217 ```html
218 <nav class="pf-v6-c-breadcrumb" aria-label="breadcrumb">
219 <ol class="pf-v6-c-breadcrumb__list" role="list">
220 <li class="pf-v6-c-breadcrumb__item">
221 <span class="pf-v6-c-breadcrumb__item-divider">
222 <svg
223 class="pf-v6-svg"
224 fill="currentColor"
225 viewBox="0 0 20 20"
226 aria-hidden="true"
227 role="img"
228 width="1em"
229 height="1em"
230 >
231 <path
232 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
233 />
234 </svg>
235 </span>
236 <a href="#" class="pf-v6-c-breadcrumb__link">Section home</a>
237 </li>
238 <li class="pf-v6-c-breadcrumb__item">
239 <span class="pf-v6-c-breadcrumb__item-divider">
240 <svg
241 class="pf-v6-svg"
242 fill="currentColor"
243 viewBox="0 0 20 20"
244 aria-hidden="true"
245 role="img"
246 width="1em"
247 height="1em"
248 >
249 <path
250 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
251 />
252 </svg>
253 </span>
254 <a href="#" class="pf-v6-c-breadcrumb__link">Section title</a>
255 </li>
256 <li class="pf-v6-c-breadcrumb__item">
257 <span class="pf-v6-c-breadcrumb__item-divider">
258 <svg
259 class="pf-v6-svg"
260 fill="currentColor"
261 viewBox="0 0 20 20"
262 aria-hidden="true"
263 role="img"
264 width="1em"
265 height="1em"
266 >
267 <path
268 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
269 />
270 </svg>
271 </span>
272 <a href="#" class="pf-v6-c-breadcrumb__link">Section title</a>
273 </li>
274 <li class="pf-v6-c-breadcrumb__item">
275 <span class="pf-v6-c-breadcrumb__item-divider">
276 <svg
277 class="pf-v6-svg"
278 fill="currentColor"
279 viewBox="0 0 20 20"
280 aria-hidden="true"
281 role="img"
282 width="1em"
283 height="1em"
284 >
285 <path
286 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
287 />
288 </svg>
289 </span>
290 <a href="#" class="pf-v6-c-breadcrumb__link">Section title</a>
291 </li>
292 <li class="pf-v6-c-breadcrumb__item">
293 <span class="pf-v6-c-breadcrumb__item-divider">
294 <svg
295 class="pf-v6-svg"
296 fill="currentColor"
297 viewBox="0 0 20 20"
298 aria-hidden="true"
299 role="img"
300 width="1em"
301 height="1em"
302 >
303 <path
304 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
305 />
306 </svg>
307 </span>
308 <h1 class="pf-v6-c-breadcrumb__heading">
309 <a
310 href="#"
311 class="pf-v6-c-breadcrumb__link pf-m-current"
312 aria-current="page"
313 >Section title</a>
314 </h1>
315 </li>
316 </ol>
317 </nav>
318
319 ```
320
321 ### With menu dropdown
322
323 ```html
324 <nav class="pf-v6-c-breadcrumb" aria-label="breadcrumb">
325 <ol class="pf-v6-c-breadcrumb__list" role="list">
326 <li class="pf-v6-c-breadcrumb__item">
327 <span class="pf-v6-c-breadcrumb__item-divider">
328 <svg
329 class="pf-v6-svg"
330 fill="currentColor"
331 viewBox="0 0 20 20"
332 aria-hidden="true"
333 role="img"
334 width="1em"
335 height="1em"
336 >
337 <path
338 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
339 />
340 </svg>
341 </span>
342 <a href="#" class="pf-v6-c-breadcrumb__link">Section home</a>
343 </li>
344 <li class="pf-v6-c-breadcrumb__item">
345 <span class="pf-v6-c-breadcrumb__item-divider">
346 <svg
347 class="pf-v6-svg"
348 fill="currentColor"
349 viewBox="0 0 20 20"
350 aria-hidden="true"
351 role="img"
352 width="1em"
353 height="1em"
354 >
355 <path
356 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
357 />
358 </svg>
359 </span>
360 <a href="#" class="pf-v6-c-breadcrumb__link">Section title</a>
361 </li>
362 <li class="pf-v6-c-breadcrumb__item">
363 <span class="pf-v6-c-breadcrumb__item-divider">
364 <svg
365 class="pf-v6-svg"
366 fill="currentColor"
367 viewBox="0 0 20 20"
368 aria-hidden="true"
369 role="img"
370 width="1em"
371 height="1em"
372 >
373 <path
374 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
375 />
376 </svg>
377 </span>
378 <span class="pf-v6-c-breadcrumb__dropdown">
379 <button
380 class="pf-v6-c-menu-toggle pf-m-text pf-m-small pf-m-plain"
381 type="button"
382 aria-expanded="false"
383 >
384 <span class="pf-v6-c-menu-toggle__count">
385 <span class="pf-v6-c-badge pf-m-read">
386 4
387 <span class="pf-v6-screen-reader">additional items</span>
388 </span>
389 </span>
390 <span class="pf-v6-c-menu-toggle__controls">
391 <span class="pf-v6-c-menu-toggle__toggle-icon">
392 <svg
393 class="pf-v6-svg"
394 fill="currentColor"
395 viewBox="0 0 20 20"
396 aria-hidden="true"
397 role="img"
398 width="1em"
399 height="1em"
400 >
401 <path
402 d="m17.65 8.76-6.674 5.72a1.496 1.496 0 0 1-.976.365c-.347 0-.694-.122-.978-.366l-6.673-5.72A1 1 0 0 1 3 7h14a1 1 0 0 1 .65 1.76Z"
403 />
404 </svg>
405 </span>
406 </span>
407 </button>
408 </span>
409 </li>
410 <li class="pf-v6-c-breadcrumb__item">
411 <span class="pf-v6-c-breadcrumb__item-divider">
412 <svg
413 class="pf-v6-svg"
414 fill="currentColor"
415 viewBox="0 0 20 20"
416 aria-hidden="true"
417 role="img"
418 width="1em"
419 height="1em"
420 >
421 <path
422 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
423 />
424 </svg>
425 </span>
426 <h1 class="pf-v6-c-breadcrumb__heading">
427 <a
428 href="#"
429 class="pf-v6-c-breadcrumb__link pf-m-current"
430 aria-current="page"
431 >Section title</a>
432 </h1>
433 </li>
434 </ol>
435 </nav>
436
437 ```
438
439 ### With buttons
440
441 ```html
442 <nav class="pf-v6-c-breadcrumb" aria-label="breadcrumb">
443 <ol class="pf-v6-c-breadcrumb__list" role="list">
444 <li class="pf-v6-c-breadcrumb__item">
445 <span class="pf-v6-c-breadcrumb__item-divider">
446 <svg
447 class="pf-v6-svg"
448 fill="currentColor"
449 viewBox="0 0 20 20"
450 aria-hidden="true"
451 role="img"
452 width="1em"
453 height="1em"
454 >
455 <path
456 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
457 />
458 </svg>
459 </span>
460 <button class="pf-v6-c-breadcrumb__link" type="button">Section home</button>
461 </li>
462 <li class="pf-v6-c-breadcrumb__item">
463 <span class="pf-v6-c-breadcrumb__item-divider">
464 <svg
465 class="pf-v6-svg"
466 fill="currentColor"
467 viewBox="0 0 20 20"
468 aria-hidden="true"
469 role="img"
470 width="1em"
471 height="1em"
472 >
473 <path
474 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
475 />
476 </svg>
477 </span>
478 <button class="pf-v6-c-breadcrumb__link" type="button">Section title</button>
479 </li>
480 <li class="pf-v6-c-breadcrumb__item">
481 <span class="pf-v6-c-breadcrumb__item-divider">
482 <svg
483 class="pf-v6-svg"
484 fill="currentColor"
485 viewBox="0 0 20 20"
486 aria-hidden="true"
487 role="img"
488 width="1em"
489 height="1em"
490 >
491 <path
492 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
493 />
494 </svg>
495 </span>
496 <button class="pf-v6-c-breadcrumb__link" type="button">Section title</button>
497 </li>
498 <li class="pf-v6-c-breadcrumb__item">
499 <span class="pf-v6-c-breadcrumb__item-divider">
500 <svg
501 class="pf-v6-svg"
502 fill="currentColor"
503 viewBox="0 0 20 20"
504 aria-hidden="true"
505 role="img"
506 width="1em"
507 height="1em"
508 >
509 <path
510 d="M14.35 8.94 6.71 1.29l-.02-.02c-.4-.38-1.03-.37-1.41.02-.38.4-.37 1.03.02 1.41l7.29 7.29-7.29 7.29a1.003 1.003 0 0 0 1.42 1.42l7.65-7.65c.59-.59.59-1.54 0-2.12Z"
511 />
512 </svg>
513 </span>
514 <button
515 class="pf-v6-c-breadcrumb__link pf-m-current"
516 type="button"
517 aria-current="page"
518 >Section landing</button>
519 </li>
520 </ol>
521 </nav>
522
523 ```
524
525 ## Documentation
526
527 ### Overview
528
529 A breadcrumb is a list of links to display a user's navigational hierarchy. The last item of the breadcrumb list indicates the current page's location.
530
531 * `.pf-v6-c-breadcrumb__list` is the default breadcrumb navigation. It provides links to previous navigation pages and also shows the current page's location.
532
533 In the event that a page does not have a traditional `<h1>` page title, a heading can be included in the breadcrumbs and an optional link within.
534
535 ### Accessibility
536
537 | Attribute | Applied to | Outcome |
538 | -- | -- | -- |
539 | `aria-label="[landmark description]"` | `.pf-v6-c-breadcrumb` | Describes `<nav>` landmark. |
540 | `aria-label="[link name]"` | `.pf-v6-c-breadcrumb__link` | If link has no text (icon), add an aria-label. |
541 | `aria-current="page"` | `.pf-v6-c-breadcrumb__item`, `.pf-v6-c-breadcrumb__link` | Indicates the current page within a set of pages. |
542
543 ### Usage
544
545 | Class | Applied to | Outcome |
546 | -- | -- | -- |
547 | `.pf-v6-c-breadcrumb` | `<nav>` | Initiates a primary breadcrumb element. **Required** |
548 | `.pf-v6-c-breadcrumb__list` | `<ol>` | Initiates default breadcrumb ordered list. |
549 | `.pf-v6-c-breadcrumb__item` | `<li>` | Initiates default breadcrumb list item. |
550 | `.pf-v6-c-breadcrumb__item-divider` | `<span>` | Initiates default breadcrumb list item divider. |
551 | `.pf-v6-c-breadcrumb__link` | `<a>`, `<button>` | Initiates default breadcrumb list link. |
552 | `.pf-v6-c-breadcrumb__title` | `<h1>` | Initiates breadcrumb header. |
553 | `.pf-m-current` | `.pf-v6-c-breadcrumb__link` | Modifies to display the list item as the current item. |