Usage
To display a banner, wrap text in a <Banner>
.
This is a banner. Use it for attention-grabbing messages.
Colors
Banners come in four variants: dark
(default), light
, transparent
, and destructive
.
This is a dark banner.
This is a light banner.
This is a transparent banner.
This is a destructive banner.
Icons
Banners can display an icon imported from FontAwesome. First import the icon, then pass it to the icon
prop.
A dark banner with an icon.
Buttons
Banners can include a call-to-action (CTA) button. Pass in ctaButtonText
and onCTAButtonClick
.
Sign in to access this page.
Dismissible
To allow banners to be dismissed, pass in onClose
and set showClose
to true.
Our terms and conditions have changed.
Groups
To group banners, import BannerGroup
. By default, the group will only display the first two banners. To show additional banners, increment max
.
Banner One
Banner Two
Banner Three
API Reference
Banner
Inherits properties from HTMLElement
.
Prop | Type | Default |
---|---|---|
children | ReactNode | |
childrenClassName | string | |
className | string | |
ctaButtonText | string | |
icon | IconProp | |
iconClassName | string | |
onClose | () => void | |
onCTAButtonClick | () => void | |
showClose | boolean | false |
variant | "dark" "light" "transparent" "destructive" | "dark" |
withIcon | boolean | true |
BannerGroup
Inherits properties from HTMLElement
.
Prop | Type | Default |
---|---|---|
children | ReactNode | |
className | string | |
max | number | 2 |