Banner
This component is mainly used in conjunction with wrap/eject in Custom Theme , and is different from components that are directly imported in MDX. You can modify the styles and functions by passing component props or directly overriding the component. If you override the entire component through eject, please note that the reading of the corresponding configuration options of the component will become invalid and you need to control it yourself.
Banner displays a notification banner at the top of the page, supporting link navigation and close functionality.
Usage
Use the Banner component through custom Layout:
Props
display
- Type:
boolean - Default:
true
Controls whether the Banner is displayed.
storage
- Type:
'localStorage' | 'sessionStorage' | false - Default:
'localStorage'
How to store the closed state after user closes the Banner. Set to false to disable storage.
storageKey
- Type:
string - Default:
'rp-banner-closed'
Storage key for the closed state.
href
- Type:
string
Link to navigate when clicking the Banner.
message
- Type:
string | ReactNode
Message content displayed in the Banner.
customChildren
- Type:
ReactNode
Fully customized Banner content. When using this property, href and message will be ignored.