| 1 |
--- |
| 2 |
id: Banner |
| 3 |
section: components |
| 4 |
cssPrefix: pf-v6-c-banner |
| 5 |
propComponents: ['Banner'] |
| 6 |
--- |
| 7 |
|
| 8 |
import RhUiCheckCircleFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-check-circle-fill-icon'; |
| 9 |
import RhUiErrorFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-error-fill-icon'; |
| 10 |
import RhUiWarningFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-warning-fill-icon'; |
| 11 |
import RhUiInformationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-information-fill-icon'; |
| 12 |
import RhUiNotificationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-notification-fill-icon'; |
| 13 |
|
| 14 |
## Examples |
| 15 |
|
| 16 |
### Basic |
| 17 |
|
| 18 |
Banners can be styled with one of 9 different colors using the `color` prop. A basic banner should only be used when the banner color does not represent status or severity. |
| 19 |
|
| 20 |
```ts file="./BannerBasic.tsx" |
| 21 |
|
| 22 |
``` |
| 23 |
|
| 24 |
### Status |
| 25 |
|
| 26 |
When a banner is used to convey status it should be styled using the `status` prop. Additionally, it is advised to pass an icon inside the banner to convey the status in a way besides just color. |
| 27 |
|
| 28 |
The `screenReaderText` prop should also be passed in to convey the status/severity of the banner to users of certain assistive technologies such as screen readers. |
| 29 |
|
| 30 |
In the following example, a flex layout is used inside the banner content to show one possible way to create spacing between the icons and banner text. |
| 31 |
|
| 32 |
```ts file="./BannerStatus.tsx" |
| 33 |
|
| 34 |
``` |
| 35 |
|
| 36 |
### Pill |
| 37 |
|
| 38 |
Banners may also have a rounded pill style by passing the `isPill` prop. |
| 39 |
|
| 40 |
```ts file="./BannerPill.tsx" |
| 41 |
|
| 42 |
``` |