| 1 |
--- |
| 2 |
id: Toggle group |
| 3 |
section: components |
| 4 |
cssPrefix: pf-v6-c-toggle-group |
| 5 |
---## Examples |
| 6 |
|
| 7 |
### Default |
| 8 |
|
| 9 |
```html |
| 10 |
<div class="pf-v6-c-toggle-group"> |
| 11 |
<div class="pf-v6-c-toggle-group__item"> |
| 12 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 13 |
<span class="pf-v6-c-toggle-group__text">Option 1</span> |
| 14 |
</button> |
| 15 |
</div> |
| 16 |
<div class="pf-v6-c-toggle-group__item"> |
| 17 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 18 |
<span class="pf-v6-c-toggle-group__text">Option 2</span> |
| 19 |
</button> |
| 20 |
</div> |
| 21 |
<div class="pf-v6-c-toggle-group__item"> |
| 22 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 23 |
<span class="pf-v6-c-toggle-group__text">Option 3</span> |
| 24 |
</button> |
| 25 |
</div> |
| 26 |
</div> |
| 27 |
|
| 28 |
<br /> |
| 29 |
|
| 30 |
<div class="pf-v6-c-toggle-group"> |
| 31 |
<div class="pf-v6-c-toggle-group__item"> |
| 32 |
<button class="pf-v6-c-toggle-group__button pf-m-selected" type="button"> |
| 33 |
<span class="pf-v6-c-toggle-group__text">Option 1</span> |
| 34 |
</button> |
| 35 |
</div> |
| 36 |
<div class="pf-v6-c-toggle-group__item"> |
| 37 |
<button class="pf-v6-c-toggle-group__button pf-m-selected" type="button"> |
| 38 |
<span class="pf-v6-c-toggle-group__text">Option 2</span> |
| 39 |
</button> |
| 40 |
</div> |
| 41 |
<div class="pf-v6-c-toggle-group__item"> |
| 42 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 43 |
<span class="pf-v6-c-toggle-group__text">Option 3</span> |
| 44 |
</button> |
| 45 |
</div> |
| 46 |
</div> |
| 47 |
|
| 48 |
<br /> |
| 49 |
|
| 50 |
<div class="pf-v6-c-toggle-group"> |
| 51 |
<div class="pf-v6-c-toggle-group__item"> |
| 52 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 53 |
<span class="pf-v6-c-toggle-group__text">Option 1</span> |
| 54 |
</button> |
| 55 |
</div> |
| 56 |
<div class="pf-v6-c-toggle-group__item"> |
| 57 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 58 |
<span class="pf-v6-c-toggle-group__text">Option 2</span> |
| 59 |
</button> |
| 60 |
</div> |
| 61 |
<div class="pf-v6-c-toggle-group__item"> |
| 62 |
<button class="pf-v6-c-toggle-group__button" type="button" disabled> |
| 63 |
<span class="pf-v6-c-toggle-group__text">Option 3</span> |
| 64 |
</button> |
| 65 |
</div> |
| 66 |
</div> |
| 67 |
|
| 68 |
``` |
| 69 |
|
| 70 |
### With icon |
| 71 |
|
| 72 |
```html |
| 73 |
<div class="pf-v6-c-toggle-group"> |
| 74 |
<div class="pf-v6-c-toggle-group__item"> |
| 75 |
<button |
| 76 |
class="pf-v6-c-toggle-group__button" |
| 77 |
type="button" |
| 78 |
aria-label="Copy button" |
| 79 |
> |
| 80 |
<span class="pf-v6-c-toggle-group__icon"> |
| 81 |
<svg |
| 82 |
class="pf-v6-svg" |
| 83 |
fill="currentColor" |
| 84 |
viewBox="0 0 32 32" |
| 85 |
aria-hidden="true" |
| 86 |
role="img" |
| 87 |
width="1em" |
| 88 |
height="1em" |
| 89 |
> |
| 90 |
<path |
| 91 |
d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-6.5 19h-16c-.827 0-1.5-.673-1.5-1.5V8a1.001 1.001 0 0 1 .294-.708l5.998-5.998A1.001 1.001 0 0 1 11 1h10.5c.827 0 1.5.673 1.5 1.5v22c0 .827-.673 1.5-1.5 1.5ZM7.414 7H10V4.414L7.414 7ZM21 3h-9v4.614C12 8.378 11.378 9 10.613 9H6v15h15V3Z" |
| 92 |
/> |
| 93 |
</svg> |
| 94 |
</span> |
| 95 |
</button> |
| 96 |
</div> |
| 97 |
<div class="pf-v6-c-toggle-group__item"> |
| 98 |
<button |
| 99 |
class="pf-v6-c-toggle-group__button" |
| 100 |
type="button" |
| 101 |
aria-label="Undo button" |
| 102 |
> |
| 103 |
<span class="pf-v6-c-toggle-group__icon"> |
| 104 |
<svg |
| 105 |
class="pf-v6-svg" |
| 106 |
fill="currentColor" |
| 107 |
viewBox="0 0 32 32" |
| 108 |
aria-hidden="true" |
| 109 |
role="img" |
| 110 |
width="1em" |
| 111 |
height="1em" |
| 112 |
> |
| 113 |
<path |
| 114 |
d="M31 20c0 5.514-4.486 10-10 10H6a1 1 0 1 1 0-2h15c4.411 0 8-3.589 8-8s-3.589-8-8-8H4.414l6.293 6.293a.999.999 0 1 1-1.414 1.414l-7.647-7.646c-.283-.283-.439-.66-.439-1.061s.156-.777.439-1.061l7.646-7.646a.999.999 0 1 1 1.414 1.414L4.413 10h16.586c5.514 0 10 4.486 10 10Z" |
| 115 |
/> |
| 116 |
</svg> |
| 117 |
</span> |
| 118 |
</button> |
| 119 |
</div> |
| 120 |
<div class="pf-v6-c-toggle-group__item"> |
| 121 |
<button |
| 122 |
class="pf-v6-c-toggle-group__button" |
| 123 |
type="button" |
| 124 |
aria-label="Share button" |
| 125 |
> |
| 126 |
<span class="pf-v6-c-toggle-group__icon"> |
| 127 |
<svg |
| 128 |
class="pf-v6-svg" |
| 129 |
fill="currentColor" |
| 130 |
viewBox="0 0 32 32" |
| 131 |
aria-hidden="true" |
| 132 |
role="img" |
| 133 |
width="1em" |
| 134 |
height="1em" |
| 135 |
> |
| 136 |
<path |
| 137 |
d="M9.293 8.707a.999.999 0 0 1 0-1.414l5.646-5.647a1.501 1.501 0 0 1 2.121 0l5.646 5.646a.999.999 0 1 1-1.414 1.414l-4.293-4.293v18.586a1 1 0 1 1-2 0V4.414l-4.293 4.293a.999.999 0 0 1-1.414 0ZM24.5 14H22a1 1 0 1 0 0 2h2v13H8V16h2a1 1 0 1 0 0-2H7.5c-.827 0-1.5.673-1.5 1.5v14c0 .827.673 1.5 1.5 1.5h17c.827 0 1.5-.673 1.5-1.5v-14c0-.827-.673-1.5-1.5-1.5Z" |
| 138 |
/> |
| 139 |
</svg> |
| 140 |
</span> |
| 141 |
</button> |
| 142 |
</div> |
| 143 |
</div> |
| 144 |
|
| 145 |
<br /> |
| 146 |
|
| 147 |
<div class="pf-v6-c-toggle-group"> |
| 148 |
<div class="pf-v6-c-toggle-group__item"> |
| 149 |
<button |
| 150 |
class="pf-v6-c-toggle-group__button pf-m-selected" |
| 151 |
type="button" |
| 152 |
aria-label="Copy button" |
| 153 |
> |
| 154 |
<span class="pf-v6-c-toggle-group__icon"> |
| 155 |
<svg |
| 156 |
class="pf-v6-svg" |
| 157 |
fill="currentColor" |
| 158 |
viewBox="0 0 32 32" |
| 159 |
aria-hidden="true" |
| 160 |
role="img" |
| 161 |
width="1em" |
| 162 |
height="1em" |
| 163 |
> |
| 164 |
<path |
| 165 |
d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-6.5 19h-16c-.827 0-1.5-.673-1.5-1.5V8a1.001 1.001 0 0 1 .294-.708l5.998-5.998A1.001 1.001 0 0 1 11 1h10.5c.827 0 1.5.673 1.5 1.5v22c0 .827-.673 1.5-1.5 1.5ZM7.414 7H10V4.414L7.414 7ZM21 3h-9v4.614C12 8.378 11.378 9 10.613 9H6v15h15V3Z" |
| 166 |
/> |
| 167 |
</svg> |
| 168 |
</span> |
| 169 |
</button> |
| 170 |
</div> |
| 171 |
<div class="pf-v6-c-toggle-group__item"> |
| 172 |
<button |
| 173 |
class="pf-v6-c-toggle-group__button" |
| 174 |
type="button" |
| 175 |
aria-label="Undo button" |
| 176 |
> |
| 177 |
<span class="pf-v6-c-toggle-group__icon"> |
| 178 |
<svg |
| 179 |
class="pf-v6-svg" |
| 180 |
fill="currentColor" |
| 181 |
viewBox="0 0 32 32" |
| 182 |
aria-hidden="true" |
| 183 |
role="img" |
| 184 |
width="1em" |
| 185 |
height="1em" |
| 186 |
> |
| 187 |
<path |
| 188 |
d="M31 20c0 5.514-4.486 10-10 10H6a1 1 0 1 1 0-2h15c4.411 0 8-3.589 8-8s-3.589-8-8-8H4.414l6.293 6.293a.999.999 0 1 1-1.414 1.414l-7.647-7.646c-.283-.283-.439-.66-.439-1.061s.156-.777.439-1.061l7.646-7.646a.999.999 0 1 1 1.414 1.414L4.413 10h16.586c5.514 0 10 4.486 10 10Z" |
| 189 |
/> |
| 190 |
</svg> |
| 191 |
</span> |
| 192 |
</button> |
| 193 |
</div> |
| 194 |
<div class="pf-v6-c-toggle-group__item"> |
| 195 |
<button |
| 196 |
class="pf-v6-c-toggle-group__button" |
| 197 |
type="button" |
| 198 |
aria-label="Share button" |
| 199 |
> |
| 200 |
<span class="pf-v6-c-toggle-group__icon"> |
| 201 |
<svg |
| 202 |
class="pf-v6-svg" |
| 203 |
fill="currentColor" |
| 204 |
viewBox="0 0 32 32" |
| 205 |
aria-hidden="true" |
| 206 |
role="img" |
| 207 |
width="1em" |
| 208 |
height="1em" |
| 209 |
> |
| 210 |
<path |
| 211 |
d="M9.293 8.707a.999.999 0 0 1 0-1.414l5.646-5.647a1.501 1.501 0 0 1 2.121 0l5.646 5.646a.999.999 0 1 1-1.414 1.414l-4.293-4.293v18.586a1 1 0 1 1-2 0V4.414l-4.293 4.293a.999.999 0 0 1-1.414 0ZM24.5 14H22a1 1 0 1 0 0 2h2v13H8V16h2a1 1 0 1 0 0-2H7.5c-.827 0-1.5.673-1.5 1.5v14c0 .827.673 1.5 1.5 1.5h17c.827 0 1.5-.673 1.5-1.5v-14c0-.827-.673-1.5-1.5-1.5Z" |
| 212 |
/> |
| 213 |
</svg> |
| 214 |
</span> |
| 215 |
</button> |
| 216 |
</div> |
| 217 |
</div> |
| 218 |
|
| 219 |
<br /> |
| 220 |
|
| 221 |
<div class="pf-v6-c-toggle-group"> |
| 222 |
<div class="pf-v6-c-toggle-group__item"> |
| 223 |
<button |
| 224 |
class="pf-v6-c-toggle-group__button" |
| 225 |
type="button" |
| 226 |
aria-label="Copy button" |
| 227 |
> |
| 228 |
<span class="pf-v6-c-toggle-group__icon"> |
| 229 |
<svg |
| 230 |
class="pf-v6-svg" |
| 231 |
fill="currentColor" |
| 232 |
viewBox="0 0 32 32" |
| 233 |
aria-hidden="true" |
| 234 |
role="img" |
| 235 |
width="1em" |
| 236 |
height="1em" |
| 237 |
> |
| 238 |
<path |
| 239 |
d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-6.5 19h-16c-.827 0-1.5-.673-1.5-1.5V8a1.001 1.001 0 0 1 .294-.708l5.998-5.998A1.001 1.001 0 0 1 11 1h10.5c.827 0 1.5.673 1.5 1.5v22c0 .827-.673 1.5-1.5 1.5ZM7.414 7H10V4.414L7.414 7ZM21 3h-9v4.614C12 8.378 11.378 9 10.613 9H6v15h15V3Z" |
| 240 |
/> |
| 241 |
</svg> |
| 242 |
</span> |
| 243 |
</button> |
| 244 |
</div> |
| 245 |
<div class="pf-v6-c-toggle-group__item"> |
| 246 |
<button |
| 247 |
class="pf-v6-c-toggle-group__button" |
| 248 |
type="button" |
| 249 |
aria-label="Undo button" |
| 250 |
> |
| 251 |
<span class="pf-v6-c-toggle-group__icon"> |
| 252 |
<svg |
| 253 |
class="pf-v6-svg" |
| 254 |
fill="currentColor" |
| 255 |
viewBox="0 0 32 32" |
| 256 |
aria-hidden="true" |
| 257 |
role="img" |
| 258 |
width="1em" |
| 259 |
height="1em" |
| 260 |
> |
| 261 |
<path |
| 262 |
d="M31 20c0 5.514-4.486 10-10 10H6a1 1 0 1 1 0-2h15c4.411 0 8-3.589 8-8s-3.589-8-8-8H4.414l6.293 6.293a.999.999 0 1 1-1.414 1.414l-7.647-7.646c-.283-.283-.439-.66-.439-1.061s.156-.777.439-1.061l7.646-7.646a.999.999 0 1 1 1.414 1.414L4.413 10h16.586c5.514 0 10 4.486 10 10Z" |
| 263 |
/> |
| 264 |
</svg> |
| 265 |
</span> |
| 266 |
</button> |
| 267 |
</div> |
| 268 |
<div class="pf-v6-c-toggle-group__item"> |
| 269 |
<button |
| 270 |
class="pf-v6-c-toggle-group__button" |
| 271 |
type="button" |
| 272 |
aria-label="Share button" |
| 273 |
disabled |
| 274 |
> |
| 275 |
<span class="pf-v6-c-toggle-group__icon"> |
| 276 |
<svg |
| 277 |
class="pf-v6-svg" |
| 278 |
fill="currentColor" |
| 279 |
viewBox="0 0 32 32" |
| 280 |
aria-hidden="true" |
| 281 |
role="img" |
| 282 |
width="1em" |
| 283 |
height="1em" |
| 284 |
> |
| 285 |
<path |
| 286 |
d="M9.293 8.707a.999.999 0 0 1 0-1.414l5.646-5.647a1.501 1.501 0 0 1 2.121 0l5.646 5.646a.999.999 0 1 1-1.414 1.414l-4.293-4.293v18.586a1 1 0 1 1-2 0V4.414l-4.293 4.293a.999.999 0 0 1-1.414 0ZM24.5 14H22a1 1 0 1 0 0 2h2v13H8V16h2a1 1 0 1 0 0-2H7.5c-.827 0-1.5.673-1.5 1.5v14c0 .827.673 1.5 1.5 1.5h17c.827 0 1.5-.673 1.5-1.5v-14c0-.827-.673-1.5-1.5-1.5Z" |
| 287 |
/> |
| 288 |
</svg> |
| 289 |
</span> |
| 290 |
</button> |
| 291 |
</div> |
| 292 |
</div> |
| 293 |
|
| 294 |
``` |
| 295 |
|
| 296 |
### Icon-and-text |
| 297 |
|
| 298 |
```html |
| 299 |
<div class="pf-v6-c-toggle-group"> |
| 300 |
<div class="pf-v6-c-toggle-group__item"> |
| 301 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 302 |
<span class="pf-v6-c-toggle-group__icon"> |
| 303 |
<svg |
| 304 |
class="pf-v6-svg" |
| 305 |
fill="currentColor" |
| 306 |
viewBox="0 0 32 32" |
| 307 |
aria-hidden="true" |
| 308 |
role="img" |
| 309 |
width="1em" |
| 310 |
height="1em" |
| 311 |
> |
| 312 |
<path |
| 313 |
d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-6.5 19h-16c-.827 0-1.5-.673-1.5-1.5V8a1.001 1.001 0 0 1 .294-.708l5.998-5.998A1.001 1.001 0 0 1 11 1h10.5c.827 0 1.5.673 1.5 1.5v22c0 .827-.673 1.5-1.5 1.5ZM7.414 7H10V4.414L7.414 7ZM21 3h-9v4.614C12 8.378 11.378 9 10.613 9H6v15h15V3Z" |
| 314 |
/> |
| 315 |
</svg> |
| 316 |
</span> |
| 317 |
<span class="pf-v6-c-toggle-group__text">Copy</span> |
| 318 |
</button> |
| 319 |
</div> |
| 320 |
<div class="pf-v6-c-toggle-group__item"> |
| 321 |
<button |
| 322 |
class="pf-v6-c-toggle-group__button" |
| 323 |
type="button" |
| 324 |
aria-label="Undo button" |
| 325 |
> |
| 326 |
<span class="pf-v6-c-toggle-group__icon"> |
| 327 |
<svg |
| 328 |
class="pf-v6-svg" |
| 329 |
fill="currentColor" |
| 330 |
viewBox="0 0 32 32" |
| 331 |
aria-hidden="true" |
| 332 |
role="img" |
| 333 |
width="1em" |
| 334 |
height="1em" |
| 335 |
> |
| 336 |
<path |
| 337 |
d="M31 20c0 5.514-4.486 10-10 10H6a1 1 0 1 1 0-2h15c4.411 0 8-3.589 8-8s-3.589-8-8-8H4.414l6.293 6.293a.999.999 0 1 1-1.414 1.414l-7.647-7.646c-.283-.283-.439-.66-.439-1.061s.156-.777.439-1.061l7.646-7.646a.999.999 0 1 1 1.414 1.414L4.413 10h16.586c5.514 0 10 4.486 10 10Z" |
| 338 |
/> |
| 339 |
</svg> |
| 340 |
</span> |
| 341 |
<span class="pf-v6-c-toggle-group__text">Undo</span> |
| 342 |
</button> |
| 343 |
</div> |
| 344 |
<div class="pf-v6-c-toggle-group__item"> |
| 345 |
<button class="pf-v6-c-toggle-group__button pf-m-selected" type="button"> |
| 346 |
<span class="pf-v6-c-toggle-group__icon"> |
| 347 |
<svg |
| 348 |
class="pf-v6-svg" |
| 349 |
fill="currentColor" |
| 350 |
viewBox="0 0 32 32" |
| 351 |
aria-hidden="true" |
| 352 |
role="img" |
| 353 |
width="1em" |
| 354 |
height="1em" |
| 355 |
> |
| 356 |
<path |
| 357 |
d="M9.293 8.707a.999.999 0 0 1 0-1.414l5.646-5.647a1.501 1.501 0 0 1 2.121 0l5.646 5.646a.999.999 0 1 1-1.414 1.414l-4.293-4.293v18.586a1 1 0 1 1-2 0V4.414l-4.293 4.293a.999.999 0 0 1-1.414 0ZM24.5 14H22a1 1 0 1 0 0 2h2v13H8V16h2a1 1 0 1 0 0-2H7.5c-.827 0-1.5.673-1.5 1.5v14c0 .827.673 1.5 1.5 1.5h17c.827 0 1.5-.673 1.5-1.5v-14c0-.827-.673-1.5-1.5-1.5Z" |
| 358 |
/> |
| 359 |
</svg> |
| 360 |
</span> |
| 361 |
<span class="pf-v6-c-toggle-group__text">Share</span> |
| 362 |
</button> |
| 363 |
</div> |
| 364 |
</div> |
| 365 |
|
| 366 |
<br /> |
| 367 |
|
| 368 |
<div class="pf-v6-c-toggle-group"> |
| 369 |
<div class="pf-v6-c-toggle-group__item"> |
| 370 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 371 |
<span class="pf-v6-c-toggle-group__text">Copy</span> |
| 372 |
<span class="pf-v6-c-toggle-group__icon"> |
| 373 |
<svg |
| 374 |
class="pf-v6-svg" |
| 375 |
fill="currentColor" |
| 376 |
viewBox="0 0 32 32" |
| 377 |
aria-hidden="true" |
| 378 |
role="img" |
| 379 |
width="1em" |
| 380 |
height="1em" |
| 381 |
> |
| 382 |
<path |
| 383 |
d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-6.5 19h-16c-.827 0-1.5-.673-1.5-1.5V8a1.001 1.001 0 0 1 .294-.708l5.998-5.998A1.001 1.001 0 0 1 11 1h10.5c.827 0 1.5.673 1.5 1.5v22c0 .827-.673 1.5-1.5 1.5ZM7.414 7H10V4.414L7.414 7ZM21 3h-9v4.614C12 8.378 11.378 9 10.613 9H6v15h15V3Z" |
| 384 |
/> |
| 385 |
</svg> |
| 386 |
</span> |
| 387 |
</button> |
| 388 |
</div> |
| 389 |
<div class="pf-v6-c-toggle-group__item"> |
| 390 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 391 |
<span class="pf-v6-c-toggle-group__text">Undo</span> |
| 392 |
<span class="pf-v6-c-toggle-group__icon"> |
| 393 |
<svg |
| 394 |
class="pf-v6-svg" |
| 395 |
fill="currentColor" |
| 396 |
viewBox="0 0 32 32" |
| 397 |
aria-hidden="true" |
| 398 |
role="img" |
| 399 |
width="1em" |
| 400 |
height="1em" |
| 401 |
> |
| 402 |
<path |
| 403 |
d="M31 20c0 5.514-4.486 10-10 10H6a1 1 0 1 1 0-2h15c4.411 0 8-3.589 8-8s-3.589-8-8-8H4.414l6.293 6.293a.999.999 0 1 1-1.414 1.414l-7.647-7.646c-.283-.283-.439-.66-.439-1.061s.156-.777.439-1.061l7.646-7.646a.999.999 0 1 1 1.414 1.414L4.413 10h16.586c5.514 0 10 4.486 10 10Z" |
| 404 |
/> |
| 405 |
</svg> |
| 406 |
</span> |
| 407 |
</button> |
| 408 |
</div> |
| 409 |
<div class="pf-v6-c-toggle-group__item"> |
| 410 |
<button class="pf-v6-c-toggle-group__button pf-m-selected" type="button"> |
| 411 |
<span class="pf-v6-c-toggle-group__text">Share</span> |
| 412 |
<span class="pf-v6-c-toggle-group__icon"> |
| 413 |
<svg |
| 414 |
class="pf-v6-svg" |
| 415 |
fill="currentColor" |
| 416 |
viewBox="0 0 32 32" |
| 417 |
aria-hidden="true" |
| 418 |
role="img" |
| 419 |
width="1em" |
| 420 |
height="1em" |
| 421 |
> |
| 422 |
<path |
| 423 |
d="M9.293 8.707a.999.999 0 0 1 0-1.414l5.646-5.647a1.501 1.501 0 0 1 2.121 0l5.646 5.646a.999.999 0 1 1-1.414 1.414l-4.293-4.293v18.586a1 1 0 1 1-2 0V4.414l-4.293 4.293a.999.999 0 0 1-1.414 0ZM24.5 14H22a1 1 0 1 0 0 2h2v13H8V16h2a1 1 0 1 0 0-2H7.5c-.827 0-1.5.673-1.5 1.5v14c0 .827.673 1.5 1.5 1.5h17c.827 0 1.5-.673 1.5-1.5v-14c0-.827-.673-1.5-1.5-1.5Z" |
| 424 |
/> |
| 425 |
</svg> |
| 426 |
</span> |
| 427 |
</button> |
| 428 |
</div> |
| 429 |
</div> |
| 430 |
|
| 431 |
``` |
| 432 |
|
| 433 |
### Compact |
| 434 |
|
| 435 |
```html |
| 436 |
<div class="pf-v6-c-toggle-group pf-m-compact"> |
| 437 |
<div class="pf-v6-c-toggle-group__item"> |
| 438 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 439 |
<span class="pf-v6-c-toggle-group__text">Option 1</span> |
| 440 |
</button> |
| 441 |
</div> |
| 442 |
<div class="pf-v6-c-toggle-group__item"> |
| 443 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 444 |
<span class="pf-v6-c-toggle-group__text">Option 2</span> |
| 445 |
</button> |
| 446 |
</div> |
| 447 |
<div class="pf-v6-c-toggle-group__item"> |
| 448 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 449 |
<span class="pf-v6-c-toggle-group__text">Option 3</span> |
| 450 |
</button> |
| 451 |
</div> |
| 452 |
</div> |
| 453 |
|
| 454 |
<br /> |
| 455 |
|
| 456 |
<div class="pf-v6-c-toggle-group pf-m-compact"> |
| 457 |
<div class="pf-v6-c-toggle-group__item"> |
| 458 |
<button class="pf-v6-c-toggle-group__button pf-m-selected" type="button"> |
| 459 |
<span class="pf-v6-c-toggle-group__text">Option 1</span> |
| 460 |
</button> |
| 461 |
</div> |
| 462 |
<div class="pf-v6-c-toggle-group__item"> |
| 463 |
<button class="pf-v6-c-toggle-group__button pf-m-selected" type="button"> |
| 464 |
<span class="pf-v6-c-toggle-group__text">Option 2</span> |
| 465 |
</button> |
| 466 |
</div> |
| 467 |
<div class="pf-v6-c-toggle-group__item"> |
| 468 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 469 |
<span class="pf-v6-c-toggle-group__text">Option 3</span> |
| 470 |
</button> |
| 471 |
</div> |
| 472 |
</div> |
| 473 |
|
| 474 |
<br /> |
| 475 |
|
| 476 |
<div class="pf-v6-c-toggle-group pf-m-compact"> |
| 477 |
<div class="pf-v6-c-toggle-group__item"> |
| 478 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 479 |
<span class="pf-v6-c-toggle-group__text">Option 1</span> |
| 480 |
</button> |
| 481 |
</div> |
| 482 |
<div class="pf-v6-c-toggle-group__item"> |
| 483 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 484 |
<span class="pf-v6-c-toggle-group__text">Option 2</span> |
| 485 |
</button> |
| 486 |
</div> |
| 487 |
<div class="pf-v6-c-toggle-group__item"> |
| 488 |
<button class="pf-v6-c-toggle-group__button" type="button" disabled> |
| 489 |
<span class="pf-v6-c-toggle-group__text">Option 3</span> |
| 490 |
</button> |
| 491 |
</div> |
| 492 |
</div> |
| 493 |
|
| 494 |
``` |
| 495 |
|
| 496 |
### Full width toggle |
| 497 |
|
| 498 |
To make toggle group items fill the available space, use `.pf-m-fill`. In the following example, the toggle group items fill the width of the parent as the window size changes. |
| 499 |
|
| 500 |
```html |
| 501 |
<div class="pf-v6-c-toggle-group pf-m-fill"> |
| 502 |
<div class="pf-v6-c-toggle-group__item"> |
| 503 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 504 |
<span class="pf-v6-c-toggle-group__text">Option 1</span> |
| 505 |
</button> |
| 506 |
</div> |
| 507 |
<div class="pf-v6-c-toggle-group__item"> |
| 508 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 509 |
<span class="pf-v6-c-toggle-group__text">Option 2</span> |
| 510 |
</button> |
| 511 |
</div> |
| 512 |
<div class="pf-v6-c-toggle-group__item"> |
| 513 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 514 |
<span class="pf-v6-c-toggle-group__text">Option 3</span> |
| 515 |
</button> |
| 516 |
</div> |
| 517 |
</div> |
| 518 |
|
| 519 |
<br /> |
| 520 |
|
| 521 |
<div class="pf-v6-c-toggle-group pf-m-fill"> |
| 522 |
<div class="pf-v6-c-toggle-group__item"> |
| 523 |
<button class="pf-v6-c-toggle-group__button pf-m-selected" type="button"> |
| 524 |
<span class="pf-v6-c-toggle-group__text">Option 1</span> |
| 525 |
</button> |
| 526 |
</div> |
| 527 |
<div class="pf-v6-c-toggle-group__item"> |
| 528 |
<button class="pf-v6-c-toggle-group__button pf-m-selected" type="button"> |
| 529 |
<span class="pf-v6-c-toggle-group__text">Option 2</span> |
| 530 |
</button> |
| 531 |
</div> |
| 532 |
<div class="pf-v6-c-toggle-group__item"> |
| 533 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 534 |
<span class="pf-v6-c-toggle-group__text">Option 3</span> |
| 535 |
</button> |
| 536 |
</div> |
| 537 |
</div> |
| 538 |
|
| 539 |
<br /> |
| 540 |
|
| 541 |
<div class="pf-v6-c-toggle-group pf-m-fill"> |
| 542 |
<div class="pf-v6-c-toggle-group__item"> |
| 543 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 544 |
<span class="pf-v6-c-toggle-group__text">Option 1</span> |
| 545 |
</button> |
| 546 |
</div> |
| 547 |
<div class="pf-v6-c-toggle-group__item"> |
| 548 |
<button class="pf-v6-c-toggle-group__button" type="button"> |
| 549 |
<span class="pf-v6-c-toggle-group__text">Option 2</span> |
| 550 |
</button> |
| 551 |
</div> |
| 552 |
<div class="pf-v6-c-toggle-group__item"> |
| 553 |
<button class="pf-v6-c-toggle-group__button" type="button" disabled> |
| 554 |
<span class="pf-v6-c-toggle-group__text">Option 3</span> |
| 555 |
</button> |
| 556 |
</div> |
| 557 |
</div> |
| 558 |
|
| 559 |
``` |
| 560 |
|
| 561 |
## Documentation |
| 562 |
|
| 563 |
### Accessibility |
| 564 |
|
| 565 |
| Attribute | Applied to | Outcome | |
| 566 |
| -- | -- | -- | |
| 567 |
| `aria-label="[button label text]"` | `.pf-v6-c-toggle-group__button` | Provides an accessible name for the button when an icon is used instead of text. **Required when icon is used with no supporting text** | |
| 568 |
| `disabled` | `.pf-v6-c-toggle-group__button` | When a button element is used, indicates that it is unavailable and removes it from keyboard focus. **Required when button is disabled** | |
| 569 |
|
| 570 |
### Usage |
| 571 |
|
| 572 |
| Class | Applied to | Outcome | |
| 573 |
| -- | -- | -- | |
| 574 |
| `.pf-v6-c-toggle-group` | `<div>` | Initiates the toggle group. **Required** | |
| 575 |
| `.pf-v6-c-toggle-group__button` | `<button>` | Initiates the toggle group button. **Required** | |
| 576 |
| `.pf-v6-c-toggle-group__item` | `<div>` | Initiates the toggle group item wrapper. **Required** | |
| 577 |
| `.pf-v6-c-toggle-group__text` | `<span>` | Initiates the toggle button text element. | |
| 578 |
| `.pf-v6-c-toggle-group__icon` | `<span>` | Initiates the toggle button icon element. | |
| 579 |
| `.pf-m-compact` | `.pf-v6-c-toggle-group` | Modifies the toggle group for compact styles. | |
| 580 |
| `.pf-m-fill` | `.pf-v6-c-toggle-group` | Modifies the group items to fill the available space. | |
| 581 |
| `.pf-m-selected` | `.pf-v6-c-toggle-group__button` | Modifies the toggle button group button for the selected state. | |