Banner
Display important messages at the top or bottom of a page
Use the Banner
component to display important messages or alerts at the top or bottom of your page. Use them to announce promotions, discounts, or limited-time offers. You can also use the Banner
component to notify users about updates, maintenance or system outages.
Banner Position
The position of the banner can be customized using the top
and bottom
props. By default, top
is set to 0. You can customize this value in case you also have a navigation menu on top of the banner:
Menu
component to see how to add a navigation menu to your page. You can also globally set the top
position of all your Banner
components by overriding the following CSS variables:
You can turn the Banner
component into a bottom banner by setting the bottom
prop to true
:
Closable Banners
Depending on the type of the banner, you might want to allow users to close it. To create a closable banner, simply set the closeable
prop to true
on the Banner
component, which will render a close icon:
Padded Banners
By default, the Banner
component will take up the full width of the available space. You can enable paddings by setting the padded
prop to true
:
Nonsticky Banners
To prevent the banner from following the viewport on scroll, set the sticky
prop to false
:
API
Prop | Default | Purpose |
---|---|---|
top | 0 | Sets the top position of the banner. |
bottom | false | Sets whether the banner should appear at the bottom of the page. |
closeable | false | Makes the banner closable. |
padded | false | Sets padding around the banner. By default, the banner has a 100% width. |
sticky | true | Sets the sticky positioning of the banner. |
className | - | Pass additional CSS classes for the banner. |
Request improvement for this page