| 1 |
--- |
| 2 |
id: Simple list |
| 3 |
section: components |
| 4 |
cssPrefix: pf-v6-c-simple-list |
| 5 |
---## Examples |
| 6 |
|
| 7 |
### Simple list |
| 8 |
|
| 9 |
```html |
| 10 |
<div class="pf-v6-c-simple-list"> |
| 11 |
<ul class="pf-v6-c-simple-list__list" role="list"> |
| 12 |
<li class="pf-v6-c-simple-list__item"> |
| 13 |
<button |
| 14 |
class="pf-v6-c-simple-list__item-link pf-m-current" |
| 15 |
type="button" |
| 16 |
>List item 1</button> |
| 17 |
</li> |
| 18 |
<li class="pf-v6-c-simple-list__item"> |
| 19 |
<button class="pf-v6-c-simple-list__item-link" type="button">List item 2</button> |
| 20 |
</li> |
| 21 |
<li class="pf-v6-c-simple-list__item"> |
| 22 |
<button class="pf-v6-c-simple-list__item-link" type="button">List item 3</button> |
| 23 |
</li> |
| 24 |
</ul> |
| 25 |
</div> |
| 26 |
|
| 27 |
``` |
| 28 |
|
| 29 |
### Simple list with links |
| 30 |
|
| 31 |
```html |
| 32 |
<div class="pf-v6-c-simple-list"> |
| 33 |
<ul class="pf-v6-c-simple-list__list" role="list"> |
| 34 |
<li class="pf-v6-c-simple-list__item"> |
| 35 |
<a |
| 36 |
class="pf-v6-c-simple-list__item-link pf-m-link pf-m-current" |
| 37 |
href="#" |
| 38 |
tabindex="0" |
| 39 |
>List item 1</a> |
| 40 |
</li> |
| 41 |
<li class="pf-v6-c-simple-list__item"> |
| 42 |
<a |
| 43 |
class="pf-v6-c-simple-list__item-link pf-m-link" |
| 44 |
href="#" |
| 45 |
tabindex="0" |
| 46 |
>List item 2</a> |
| 47 |
</li> |
| 48 |
<li class="pf-v6-c-simple-list__item"> |
| 49 |
<a |
| 50 |
class="pf-v6-c-simple-list__item-link pf-m-link" |
| 51 |
href="#" |
| 52 |
tabindex="0" |
| 53 |
>List item 3</a> |
| 54 |
</li> |
| 55 |
</ul> |
| 56 |
</div> |
| 57 |
|
| 58 |
``` |
| 59 |
|
| 60 |
### Grouped list |
| 61 |
|
| 62 |
```html |
| 63 |
<div class="pf-v6-c-simple-list"> |
| 64 |
<section class="pf-v6-c-simple-list__section"> |
| 65 |
<h2 class="pf-v6-c-simple-list__title">Title</h2> |
| 66 |
<ul class="pf-v6-c-simple-list__list" role="list"> |
| 67 |
<li class="pf-v6-c-simple-list__item"> |
| 68 |
<button |
| 69 |
class="pf-v6-c-simple-list__item-link pf-m-current" |
| 70 |
type="button" |
| 71 |
>List item 1</button> |
| 72 |
</li> |
| 73 |
<li class="pf-v6-c-simple-list__item"> |
| 74 |
<button class="pf-v6-c-simple-list__item-link" type="button">List item 2</button> |
| 75 |
</li> |
| 76 |
<li class="pf-v6-c-simple-list__item"> |
| 77 |
<button class="pf-v6-c-simple-list__item-link" type="button">List item 3</button> |
| 78 |
</li> |
| 79 |
<li class="pf-v6-c-simple-list__item"> |
| 80 |
<button class="pf-v6-c-simple-list__item-link" type="button">List item 4</button> |
| 81 |
</li> |
| 82 |
</ul> |
| 83 |
</section> |
| 84 |
<section class="pf-v6-c-simple-list__section"> |
| 85 |
<h2 class="pf-v6-c-simple-list__title">Title</h2> |
| 86 |
<ul class="pf-v6-c-simple-list__list" role="list"> |
| 87 |
<li class="pf-v6-c-simple-list__item"> |
| 88 |
<button class="pf-v6-c-simple-list__item-link" type="button">List item 1</button> |
| 89 |
</li> |
| 90 |
<li class="pf-v6-c-simple-list__item"> |
| 91 |
<button class="pf-v6-c-simple-list__item-link" type="button">List item 2</button> |
| 92 |
</li> |
| 93 |
<li class="pf-v6-c-simple-list__item"> |
| 94 |
<button class="pf-v6-c-simple-list__item-link" type="button">List item 3</button> |
| 95 |
</li> |
| 96 |
<li class="pf-v6-c-simple-list__item"> |
| 97 |
<button class="pf-v6-c-simple-list__item-link" type="button">List item 4</button> |
| 98 |
</li> |
| 99 |
</ul> |
| 100 |
</section> |
| 101 |
</div> |
| 102 |
|
| 103 |
``` |
| 104 |
|
| 105 |
## Documentation |
| 106 |
|
| 107 |
### Accessibility |
| 108 |
|
| 109 |
| Attribute | Applied to | Outcome | |
| 110 |
| -- | -- | -- | |
| 111 |
| `tabindex="0"` | `a.pf-v6-c-simple-list__item-link` | Inserts the link into the tab order of the page so that it is focusable. **Required** | |
| 112 |
|
| 113 |
### Usage |
| 114 |
|
| 115 |
| Class | Applied to | Outcome | |
| 116 |
| -- | -- | -- | |
| 117 |
| `.pf-v6-c-simple-list` | `<div>` | Initiates a simple list. | |
| 118 |
| `.pf-v6-c-simple-list__section` | `<section>` | Initiates a simple list section. | |
| 119 |
| `.pf-v6-c-simple-list__title` | `<h2>` | Initiates a simple list title. | |
| 120 |
| `.pf-v6-c-simple-list__list` | `<ul>` | Initiates a simple list unordered list. | |
| 121 |
| `.pf-v6-c-simple-list__item` | `<li>` | Initiates a simple list item. | |
| 122 |
| `.pf-v6-c-simple-list__item-link` | `<button>`, `<a>` | Initiates a simple list item link. It can be a button or a link depending on the context. | |
| 123 |
| `.pf-m-current` | `.pf-v6-c-simple-list__item-link` | Modifies the simple list item link for the current state. | |