| 1 |
--- |
| 2 |
id: 'Icon' |
| 3 |
section: components |
| 4 |
cssPrefix: pf-v6-c-icon |
| 5 |
---## Examples |
| 6 |
|
| 7 |
### Basic |
| 8 |
|
| 9 |
```html |
| 10 |
<span class="pf-v6-c-icon"> |
| 11 |
<span class="pf-v6-c-icon__content"> |
| 12 |
<i class="fas fa-long-arrow-alt-down" aria-hidden="true"></i> |
| 13 |
</span> |
| 14 |
</span> |
| 15 |
|
| 16 |
<span class="pf-v6-c-icon"> |
| 17 |
<span class="pf-v6-c-icon__content"> |
| 18 |
<svg |
| 19 |
class="pf-v6-svg" |
| 20 |
fill="currentColor" |
| 21 |
viewBox="0 0 20 20" |
| 22 |
aria-hidden="true" |
| 23 |
role="img" |
| 24 |
width="1em" |
| 25 |
height="1em" |
| 26 |
> |
| 27 |
<path |
| 28 |
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" |
| 29 |
/> |
| 30 |
</svg> |
| 31 |
</span> |
| 32 |
</span> |
| 33 |
|
| 34 |
<span class="pf-v6-c-icon"> |
| 35 |
<span class="pf-v6-c-icon__content"> |
| 36 |
<svg |
| 37 |
class="pf-v6-svg" |
| 38 |
fill="currentColor" |
| 39 |
viewBox="0 0 20 20" |
| 40 |
aria-hidden="true" |
| 41 |
role="img" |
| 42 |
width="1em" |
| 43 |
height="1em" |
| 44 |
> |
| 45 |
<path |
| 46 |
d="M18.71 5.29a.996.996 0 0 0-1.41 0l-7.29 7.29-7.3-7.29a.987.987 0 0 0-1.41-.02.987.987 0 0 0-.02 1.41l.02.02 7.65 7.65c.29.29.68.44 1.06.44s.77-.15 1.06-.44l7.65-7.65a.996.996 0 0 0 0-1.41Z" |
| 47 |
/> |
| 48 |
</svg> |
| 49 |
</span> |
| 50 |
</span> |
| 51 |
|
| 52 |
<span class="pf-v6-c-icon"> |
| 53 |
<span class="pf-v6-c-icon__content"> |
| 54 |
<svg |
| 55 |
class="pf-v6-svg" |
| 56 |
fill="currentColor" |
| 57 |
viewBox="0 0 32 32" |
| 58 |
aria-hidden="true" |
| 59 |
role="img" |
| 60 |
width="1em" |
| 61 |
height="1em" |
| 62 |
> |
| 63 |
<path |
| 64 |
d="M26.463 16.845a9.635 9.635 0 0 0-.002-1.688l3.41-1.974a.5.5 0 0 0 .235-.548 14.47 14.47 0 0 0-4.142-7.167.5.5 0 0 0-.594-.07l-3.404 1.97c-.469-.326-.96-.61-1.466-.85V2.58a.5.5 0 0 0-.356-.48 14.662 14.662 0 0 0-8.288 0 .5.5 0 0 0-.356.48v3.944c-.513.245-1.003.528-1.462.846L6.63 5.397a.5.5 0 0 0-.594.07 14.47 14.47 0 0 0-4.142 7.168.5.5 0 0 0 .236.548l3.407 1.972a9.635 9.635 0 0 0 .002 1.688l-3.41 1.974a.5.5 0 0 0-.235.548 14.47 14.47 0 0 0 4.142 7.167c.16.154.405.18.594.07l3.404-1.97c.469.326.96.61 1.466.85v3.938a.5.5 0 0 0 .356.48c1.333.398 2.728.6 4.144.6s2.81-.202 4.144-.6a.5.5 0 0 0 .356-.48v-3.944a10.449 10.449 0 0 0 1.462-.846l3.408 1.973a.5.5 0 0 0 .594-.07 14.47 14.47 0 0 0 4.142-7.168.5.5 0 0 0-.236-.548l-3.407-1.972ZM16 21c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5Z" |
| 65 |
/> |
| 66 |
</svg> |
| 67 |
</span> |
| 68 |
</span> |
| 69 |
|
| 70 |
``` |
| 71 |
|
| 72 |
### Standalone icon sizes |
| 73 |
|
| 74 |
```html |
| 75 |
<span class="pf-v6-c-icon pf-m-sm"> |
| 76 |
<span class="pf-v6-c-icon__content"> |
| 77 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 78 |
</span> |
| 79 |
</span> |
| 80 |
<span class="pf-v6-c-icon pf-m-md"> |
| 81 |
<span class="pf-v6-c-icon__content"> |
| 82 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 83 |
</span> |
| 84 |
</span> |
| 85 |
<span class="pf-v6-c-icon pf-m-lg"> |
| 86 |
<span class="pf-v6-c-icon__content"> |
| 87 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 88 |
</span> |
| 89 |
</span> |
| 90 |
<span class="pf-v6-c-icon pf-m-xl"> |
| 91 |
<span class="pf-v6-c-icon__content"> |
| 92 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 93 |
</span> |
| 94 |
</span> |
| 95 |
<span class="pf-v6-c-icon pf-m-2xl"> |
| 96 |
<span class="pf-v6-c-icon__content"> |
| 97 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 98 |
</span> |
| 99 |
</span> |
| 100 |
<span class="pf-v6-c-icon pf-m-3xl"> |
| 101 |
<span class="pf-v6-c-icon__content"> |
| 102 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 103 |
</span> |
| 104 |
</span> |
| 105 |
|
| 106 |
``` |
| 107 |
|
| 108 |
### Body sizes |
| 109 |
|
| 110 |
```html |
| 111 |
<span class="pf-v6-c-icon pf-m-body-sm"> |
| 112 |
<span class="pf-v6-c-icon__content"> |
| 113 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 114 |
</span> |
| 115 |
</span> |
| 116 |
<span class="pf-v6-c-icon pf-m-body-default"> |
| 117 |
<span class="pf-v6-c-icon__content"> |
| 118 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 119 |
</span> |
| 120 |
</span> |
| 121 |
<span class="pf-v6-c-icon pf-m-body-lg"> |
| 122 |
<span class="pf-v6-c-icon__content"> |
| 123 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 124 |
</span> |
| 125 |
</span> |
| 126 |
|
| 127 |
``` |
| 128 |
|
| 129 |
### Heading sizes |
| 130 |
|
| 131 |
```html |
| 132 |
<span class="pf-v6-c-icon pf-m-heading-sm"> |
| 133 |
<span class="pf-v6-c-icon__content"> |
| 134 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 135 |
</span> |
| 136 |
</span> |
| 137 |
<span class="pf-v6-c-icon pf-m-heading-md"> |
| 138 |
<span class="pf-v6-c-icon__content"> |
| 139 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 140 |
</span> |
| 141 |
</span> |
| 142 |
<span class="pf-v6-c-icon pf-m-heading-lg"> |
| 143 |
<span class="pf-v6-c-icon__content"> |
| 144 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 145 |
</span> |
| 146 |
</span> |
| 147 |
<span class="pf-v6-c-icon pf-m-heading-xl"> |
| 148 |
<span class="pf-v6-c-icon__content"> |
| 149 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 150 |
</span> |
| 151 |
</span> |
| 152 |
<span class="pf-v6-c-icon pf-m-heading-2xl"> |
| 153 |
<span class="pf-v6-c-icon__content"> |
| 154 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 155 |
</span> |
| 156 |
</span> |
| 157 |
<span class="pf-v6-c-icon pf-m-heading-3xl"> |
| 158 |
<span class="pf-v6-c-icon__content"> |
| 159 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 160 |
</span> |
| 161 |
</span> |
| 162 |
|
| 163 |
``` |
| 164 |
|
| 165 |
### Status colors |
| 166 |
|
| 167 |
```html |
| 168 |
<span class="pf-v6-c-icon"> |
| 169 |
<span class="pf-v6-c-icon__content pf-m-danger"> |
| 170 |
<svg |
| 171 |
class="pf-v6-svg" |
| 172 |
fill="currentColor" |
| 173 |
viewBox="0 0 32 32" |
| 174 |
aria-hidden="true" |
| 175 |
role="img" |
| 176 |
width="1em" |
| 177 |
height="1em" |
| 178 |
> |
| 179 |
<path |
| 180 |
d="M16 1C7.729 1 1 7.729 1 16s6.729 15 15 15 15-6.729 15-15S24.271 1 16 1Zm-1.5 8a1.5 1.5 0 1 1 3 0v7a1.5 1.5 0 1 1-3 0V9ZM16 25.001a2 2 0 1 1-.001-3.999A2 2 0 0 1 16 25.001Z" |
| 181 |
/> |
| 182 |
</svg> |
| 183 |
</span> |
| 184 |
</span> |
| 185 |
<span class="pf-v6-c-icon"> |
| 186 |
<span class="pf-v6-c-icon__content pf-m-warning"> |
| 187 |
<svg |
| 188 |
class="pf-v6-svg" |
| 189 |
fill="currentColor" |
| 190 |
viewBox="0 0 32 32" |
| 191 |
aria-hidden="true" |
| 192 |
role="img" |
| 193 |
width="1em" |
| 194 |
height="1em" |
| 195 |
> |
| 196 |
<path |
| 197 |
d="m31.874 28.514-15.011-27a1.001 1.001 0 0 0-1.748 0l-15.011 27A1 1 0 0 0 .978 30H31a1 1 0 0 0 .874-1.486ZM14.5 12a1.5 1.5 0 0 1 3 0v5a1.5 1.5 0 0 1-3 0v-5ZM16 26.001a2 2 0 1 1-.001-3.999A2 2 0 0 1 16 26.001Z" |
| 198 |
/> |
| 199 |
</svg> |
| 200 |
</span> |
| 201 |
</span> |
| 202 |
<span class="pf-v6-c-icon"> |
| 203 |
<span class="pf-v6-c-icon__content pf-m-success"> |
| 204 |
<svg |
| 205 |
class="pf-v6-svg" |
| 206 |
fill="currentColor" |
| 207 |
viewBox="0 0 32 32" |
| 208 |
aria-hidden="true" |
| 209 |
role="img" |
| 210 |
width="1em" |
| 211 |
height="1em" |
| 212 |
> |
| 213 |
<path |
| 214 |
d="M16 1C7.729 1 1 7.729 1 16s6.729 15 15 15 15-6.729 15-15S24.271 1 16 1Zm7.795 11.795-8.646 8.646c-.317.317-.733.475-1.149.475s-.832-.158-1.149-.475l-4.646-4.646a1.126 1.126 0 0 1 1.591-1.591l4.205 4.205 8.205-8.205a1.126 1.126 0 0 1 1.591 1.591Z" |
| 215 |
/> |
| 216 |
</svg> |
| 217 |
</span> |
| 218 |
</span> |
| 219 |
<span class="pf-v6-c-icon"> |
| 220 |
<span class="pf-v6-c-icon__content pf-m-info"> |
| 221 |
<svg |
| 222 |
class="pf-v6-svg" |
| 223 |
fill="currentColor" |
| 224 |
viewBox="0 0 32 32" |
| 225 |
aria-hidden="true" |
| 226 |
role="img" |
| 227 |
width="1em" |
| 228 |
height="1em" |
| 229 |
> |
| 230 |
<path |
| 231 |
d="M16 1C7.729 1 1 7.729 1 16s6.729 15 15 15 15-6.729 15-15S24.271 1 16 1Zm1.5 22a1.5 1.5 0 1 1-3 0v-5.157l-.188.04a1.5 1.5 0 0 1-.625-2.934l1.956-.416c.112-.024.223-.032.333-.03l.024-.002a1.5 1.5 0 0 1 1.5 1.5v7Zm-.08-12.58c-.38.37-.89.58-1.42.58a1.998 1.998 0 0 1-1.851-2.76c.051-.13.11-.24.19-.35.07-.11.15-.21.25-.3.74-.75 2.08-.75 2.83 0 .09.09.17.19.24.3.08.11.14.22.189.35.05.12.09.24.11.37.03.13.04.26.04.39 0 .53-.21 1.04-.58 1.42Z" |
| 232 |
/> |
| 233 |
</svg> |
| 234 |
</span> |
| 235 |
</span> |
| 236 |
<span class="pf-v6-c-icon"> |
| 237 |
<span class="pf-v6-c-icon__content pf-m-custom"> |
| 238 |
<svg |
| 239 |
class="pf-v6-svg" |
| 240 |
fill="currentColor" |
| 241 |
viewBox="0 0 32 32" |
| 242 |
aria-hidden="true" |
| 243 |
role="img" |
| 244 |
width="1em" |
| 245 |
height="1em" |
| 246 |
> |
| 247 |
<path |
| 248 |
d="M28.75 22v3.5c0 .689-.561 1.25-1.25 1.25h-7.521c.005.084.021.166.021.25 0 2.206-1.794 4-4 4s-4-1.794-4-4c0-.084.016-.166.021-.25H4.5c-.689 0-1.25-.561-1.25-1.25V22a.75.75 0 0 1 .75-.75c1.24 0 2.25-1.009 2.25-2.25v-4c0-4.826 3.528-8.833 8.138-9.605A2.482 2.482 0 0 1 13.5 3.5C13.5 2.122 14.621 1 16 1s2.5 1.122 2.5 2.5c0 .761-.349 1.436-.888 1.895 4.61.772 8.138 4.779 8.138 9.605v4c0 1.241 1.01 2.25 2.25 2.25a.75.75 0 0 1 .75.75Z" |
| 249 |
/> |
| 250 |
</svg> |
| 251 |
</span> |
| 252 |
</span> |
| 253 |
|
| 254 |
``` |
| 255 |
|
| 256 |
### Sizing content within the icon container |
| 257 |
|
| 258 |
Use a size modifier on the icon container to maintain a consistent size, even if the contents change in size. |
| 259 |
|
| 260 |
```html |
| 261 |
<span class="pf-v6-c-icon pf-m-3xl pf-m-inline"> |
| 262 |
<span class="pf-v6-c-icon__content pf-m-lg"> |
| 263 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 264 |
</span> |
| 265 |
</span> |
| 266 |
<span class="pf-v6-c-icon pf-m-3xl pf-m-inline"> |
| 267 |
<span class="pf-v6-c-icon__content pf-m-xl"> |
| 268 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 269 |
</span> |
| 270 |
</span> |
| 271 |
<span class="pf-v6-c-icon pf-m-3xl pf-m-inline"> |
| 272 |
<span class="pf-v6-c-icon__content pf-m-2xl"> |
| 273 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 274 |
</span> |
| 275 |
</span> |
| 276 |
<span class="pf-v6-c-icon pf-m-3xl pf-m-inline"> |
| 277 |
<span class="pf-v6-c-icon__content pf-m-3xl"> |
| 278 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 279 |
</span> |
| 280 |
</span> |
| 281 |
|
| 282 |
``` |
| 283 |
|
| 284 |
### Inline |
| 285 |
|
| 286 |
```html |
| 287 |
<div class="pf-v6-c-content"> |
| 288 |
<h1> |
| 289 |
Heading |
| 290 |
<span class="pf-v6-c-icon pf-m-inline"> |
| 291 |
<span class="pf-v6-c-icon__content"> |
| 292 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 293 |
</span> |
| 294 |
</span> |
| 295 |
</h1> |
| 296 |
<p> |
| 297 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit |
| 298 |
Sed hendrerit nisi in cursus maximus. |
| 299 |
</p> |
| 300 |
<h2> |
| 301 |
Second level |
| 302 |
<span class="pf-v6-c-icon pf-m-inline"> |
| 303 |
<span class="pf-v6-c-icon__content"> |
| 304 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 305 |
</span> |
| 306 |
</span> |
| 307 |
</h2> |
| 308 |
<p> |
| 309 |
<span class="pf-v6-c-icon pf-m-inline"> |
| 310 |
<span class="pf-v6-c-icon__content"> |
| 311 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 312 |
</span> |
| 313 |
</span> |
| 314 |
Curabitur accumsan turpis pharetra |
| 315 |
<strong> |
| 316 |
augue tincidunt |
| 317 |
<span class="pf-v6-c-icon pf-m-inline"> |
| 318 |
<span class="pf-v6-c-icon__content"> |
| 319 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 320 |
</span> |
| 321 |
</span> |
| 322 |
</strong> blandit. Quisque condimentum maximus mi, sit amet commodo arcu rutrum id. Proin pretium urna vel |
| 323 |
cursus venenatis. Suspendisse potenti. |
| 324 |
</p> |
| 325 |
<small> |
| 326 |
Sometimes you need small text |
| 327 |
<span class="pf-v6-c-icon pf-m-inline"> |
| 328 |
<span class="pf-v6-c-icon__content"> |
| 329 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 330 |
</span> |
| 331 |
</span> |
| 332 |
</small> |
| 333 |
</div>Inline with size specified: |
| 334 |
<span class="pf-v6-c-icon pf-m-sm pf-m-inline"> |
| 335 |
<span class="pf-v6-c-icon__content"> |
| 336 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 337 |
</span> |
| 338 |
</span> |
| 339 |
small, |
| 340 |
<span class="pf-v6-c-icon pf-m-md pf-m-inline"> |
| 341 |
<span class="pf-v6-c-icon__content"> |
| 342 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 343 |
</span> |
| 344 |
</span> |
| 345 |
medium, |
| 346 |
<span class="pf-v6-c-icon pf-m-lg pf-m-inline"> |
| 347 |
<span class="pf-v6-c-icon__content"> |
| 348 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 349 |
</span> |
| 350 |
</span> |
| 351 |
large, |
| 352 |
<span class="pf-v6-c-icon pf-m-xl pf-m-inline"> |
| 353 |
<span class="pf-v6-c-icon__content"> |
| 354 |
<i class="fas fa-plus-circle" aria-hidden="true"></i> |
| 355 |
</span> |
| 356 |
</span> |
| 357 |
extra large |
| 358 |
|
| 359 |
``` |
| 360 |
|
| 361 |
### In progress |
| 362 |
|
| 363 |
```html |
| 364 |
<span class="pf-v6-c-icon pf-m-md pf-m-in-progress"> |
| 365 |
<span class="pf-v6-c-icon__content"> |
| 366 |
<i class="fas fa-check-circle" aria-hidden="true"></i> |
| 367 |
</span> |
| 368 |
<span class="pf-v6-c-icon__progress"> |
| 369 |
<svg |
| 370 |
class="pf-v6-c-spinner pf-m-md" |
| 371 |
role="progressbar" |
| 372 |
viewBox="0 0 100 100" |
| 373 |
aria-label="Loading..." |
| 374 |
> |
| 375 |
<circle class="pf-v6-c-spinner__path" cx="50" cy="50" r="45" fill="none" /> |
| 376 |
</svg> |
| 377 |
</span> |
| 378 |
</span> |
| 379 |
|
| 380 |
<span class="pf-v6-c-icon pf-m-md"> |
| 381 |
<span class="pf-v6-c-icon__content"> |
| 382 |
<i class="fas fa-check-circle" aria-hidden="true"></i> |
| 383 |
</span> |
| 384 |
</span> |
| 385 |
|
| 386 |
``` |
| 387 |
|
| 388 |
## Documentation |
| 389 |
|
| 390 |
### Overview |
| 391 |
|
| 392 |
The icon element is a container used to maintain a stable space for an icon or spinner, regardless of size or aspect ratio of the contents. |
| 393 |
|
| 394 |
Refer to the [icons](/foundations-and-styles/iconography) page for information about the PatternFly icon set and guidelines for use. |
| 395 |
|
| 396 |
### Usage |
| 397 |
|
| 398 |
| Class | Applied to | Outcome | |
| 399 |
| -- | -- | -- | |
| 400 |
| `.pf-v6-c-icon` | `<span>`, `<div>` | Initiates an icon component. **Required** | |
| 401 |
| `.pf-v6-c-icon__content` | `<span>`, `<div>` | Initiates the icon content. **Required** | |
| 402 |
| `.pf-v6-c-icon__progress` | `<span>`, `<div>` | Initiates a container for a progress spinner. | |
| 403 |
| `.pf-m-inline` | `.pf-v6-c-icon` | Displays the icon inline with text, and allows the icon to inherit the size and color of the parent. | |
| 404 |
| `.pf-m-[sm,md,lg,xl,2xl,3xl]` | `.pf-v6-c-icon` | Modifies the icon container to be small, medium, large, extra large, double extra large, or triple extra large. | |
| 405 |
| `.pf-m-body-[sm,default,lg]` | `.pf-v6-c-icon` | Modifies the icon container to be a size matching small, default, or large body text. | |
| 406 |
| `.pf-m-heading-[sm,md,lg,xl,2xl,3xl]` | `.pf-v6-c-icon` | Modifies the icon container to be a size matching small, medium, large, extra large, double extra large, or triple extra large (h6-h1) heading text. | |
| 407 |
| `.pf-m-[sm,md,lg,xl,2xl,3xl]` | `.pf-v6-c-icon__content`, `pf-v6-c-icon__progress` | Modifies the icon content or progress element to be small, medium, large, or extra large. | |
| 408 |
| `.pf-m-body-[sm,default,lg]` | `.pf-v6-c-icon__content` | Modifies the icon content or progress element to be a size matching small, default, or large body text. | |
| 409 |
| `.pf-m-heading-[sm,md,lg,xl,2xl,3xl]` | `.pf-v6-c-icon__content` | Modifies the icon content or progress element to be a size matching small, medium, large, extra large, double extra large, or triple extra large (h6-h1) heading text. | |
| 410 |
| `.pf-m-in-progress` | `.pf-v6-c-icon` | Shows the progress element in place of the icon content. | |
| 411 |
| `.pf-m-danger`, `.pf-m-warning`, `.pf-m-success`, `.pf-m-info`, `.pf-m-custom` | `.pf-v6-c-icon__content` | Modifies the icon content to use a status color. | |