@patternfly/react-core
Version:
This library provides a set of common React components for use with the PatternFly reference implementation.
35 lines (22 loc) • 1.34 kB
Markdown
---
id: Banner
section: components
cssPrefix: pf-v6-c-banner
propComponents: ['Banner']
---
import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
import ExclamationTriangleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-triangle-icon';
import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
## Examples
### Basic
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.
```ts file="./BannerBasic.tsx"
```
### Status
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.
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.
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.
```ts file="./BannerStatus.tsx"
```