| 1 |
--- |
| 2 |
id: Icon |
| 3 |
section: components |
| 4 |
cssPrefix: pf-v6-c-icon |
| 5 |
propComponents: ['Icon'] |
| 6 |
--- |
| 7 |
|
| 8 |
import { Fragment, useState } from 'react'; |
| 9 |
import LongArrowAltDownIcon from '@patternfly/react-icons/dist/esm/icons/long-arrow-alt-down-icon'; |
| 10 |
import RhMicronsCaretRightIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-right-icon'; |
| 11 |
import RhMicronsCaretDownIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-down-icon'; |
| 12 |
import RhUiSettingsFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-settings-fill-icon'; |
| 13 |
import RhUiAddCircleFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-add-circle-fill-icon'; |
| 14 |
import RhUiErrorFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-error-fill-icon'; |
| 15 |
import RhUiWarningFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-warning-fill-icon'; |
| 16 |
import RhUiCheckCircleFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-check-circle-fill-icon'; |
| 17 |
import RhUiInformationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-information-fill-icon'; |
| 18 |
import RhUiNotificationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-notification-fill-icon'; |
| 19 |
|
| 20 |
## Examples |
| 21 |
|
| 22 |
### Basic |
| 23 |
|
| 24 |
```ts file="IconBasic.tsx" |
| 25 |
|
| 26 |
``` |
| 27 |
|
| 28 |
### Standalone icon sizes |
| 29 |
|
| 30 |
These are the standard options for sizing icons. |
| 31 |
|
| 32 |
```ts file="StandaloneIconSizes.tsx" |
| 33 |
|
| 34 |
``` |
| 35 |
|
| 36 |
### Body sizes |
| 37 |
|
| 38 |
These size options are meant to make icons match the size of body text. |
| 39 |
|
| 40 |
```ts file="BodyIconSizes.tsx" |
| 41 |
|
| 42 |
``` |
| 43 |
|
| 44 |
### Heading sizes |
| 45 |
|
| 46 |
These size options are meant to make icons match the size of heading text. |
| 47 |
|
| 48 |
```ts file="HeadingIconSizes.tsx" |
| 49 |
|
| 50 |
``` |
| 51 |
|
| 52 |
### Status colors |
| 53 |
|
| 54 |
The following example demonstrates the various status variants of an icon. Keep in mind that these icons are displayed out of a typical context, and that you should not rely on color alone to convey status to users. |
| 55 |
|
| 56 |
```ts file="IconStatus.tsx" |
| 57 |
|
| 58 |
``` |
| 59 |
|
| 60 |
### Sizing an icon within the icon container |
| 61 |
|
| 62 |
Providing both size and iconSize properties allows the icon container to maintain a consistent size, even if the icon changes in size. |
| 63 |
|
| 64 |
```ts file="IconContentSizes.tsx" |
| 65 |
|
| 66 |
``` |
| 67 |
|
| 68 |
### Inline |
| 69 |
|
| 70 |
```ts file="IconInline.tsx" |
| 71 |
|
| 72 |
``` |
| 73 |
|
| 74 |
### In progress |
| 75 |
|
| 76 |
Passing the `isInProgress` property will swap the icon to a progress icon. By default this progress icon will be a `Spinner` but may be customized or overriden using the `progressIcon` property. |
| 77 |
|
| 78 |
```ts file="IconProgress.tsx" |
| 79 |
|
| 80 |
``` |
| 81 |
|
| 82 |
### Custom in progress icon |
| 83 |
|
| 84 |
```ts file="IconCustomProgress.tsx" |
| 85 |
|
| 86 |
``` |