Banner
The banner component highlights important information or required actions prominently within the interface. Use banner to communicate statuses, provide feedback, draw attention to critical updates, or guide users toward necessary actions.
Banners support multiple tones to convey urgency levels, optional actions for next steps, and can be positioned contextually within sections or page-wide at the top. For inline status indicators on individual items, use badge.
Anchor to PropertiesProperties
Configure the following properties on the banner component.
- stringstringDefault: ''Default: ''requiredrequired
The heading text displayed at the top of the banner.
- "info" | "success" | "warning" | "critical" | "auto""info" | "success" | "warning" | "critical" | "auto"Default: 'auto'Default: 'auto'requiredrequired
The semantic meaning and color treatment of the component.
info: Informational content or helpful tips.success: Positive outcomes or successful states.warning: Important warnings about potential issues.critical: Urgent problems or destructive actions.auto: Automatically determined based on context.
- booleanbooleanDefault: falseDefault: falserequiredrequired
Controls whether the banner is visible or hidden.
When using a controlled component pattern and the banner is
dismissible, update this property totruewhen thedismissevent fires.You can hide the banner programmatically by setting this to
trueeven if it's notdismissible.- booleanbooleanDefault: falseDefault: falserequiredrequired
Whether the banner displays a close button that allows users to dismiss it.
When the close button is pressed, the
dismissevent fires, thenhiddenis set totrue, any animation completes, and theafterhideevent fires.
Anchor to EventsEvents
The banner component provides event callbacks for handling user interactions. Learn more about handling events.
- CallbackEventListener<typeof tagName> | nullCallbackEventListener<typeof tagName> | nullrequiredrequired
A callback fired after the banner is hidden.
- CallbackEventListener<typeof tagName> | nullCallbackEventListener<typeof tagName> | nullrequiredrequired
A callback fired when the banner is dismissed.
CallbackEventListener
A function that handles events from UI components. This type represents an event listener callback that receives a `CallbackEvent` with a strongly-typed `currentTarget`. Use this for component event handlers like `click`, `focus`, `blur`, and other DOM events.
(EventListener & {
(event: CallbackEvent<T>): void;
}) | nullCallbackEvent
An event object with a strongly-typed `currentTarget` property that references the specific HTML element that triggered the event. This type extends the standard DOM `Event` interface and ensures type safety when accessing the element that fired the event.
Event & {
currentTarget: HTMLElementTagNameMap[T];
}Anchor to SlotsSlots
The banner component supports slots for additional content placement within the banner. Learn more about using slots.
- HTMLElementHTMLElement
The main message content displayed within the banner component, providing important information or guidance to users.
- HTMLElementHTMLElement
Action buttons displayed at the bottom of the banner that let users respond to the message. Accepts up to two button components with
variant="secondary"orvariant="auto".
Anchor to ExamplesExamples
Create an informational banner with a heading and body text. This example shows a basic banner communicating a status update that merchants can dismiss.
Preview
html
Use a warning-toned banner with secondary action buttons to highlight a problem and give merchants clear next steps. This example shows a shipping weight issue with links to review products and access a setup guide.
Preview
html
Anchor to Alert merchants to critical issues requiring actionAlert merchants to critical issues requiring action
Use a critical-toned banner to signal an urgent issue that requires immediate merchant action. This example shows a fraud review alert with buttons to review order details and adjust settings.
Preview
html
Use a success-toned banner with the dismissible property to confirm a completed operation. This example shows a product import confirmation that merchants can dismiss once acknowledged.
Preview
html
Anchor to Best practicesBest practices
- Focus on single actions: Present one piece of information or required action per banner to maintain clarity and prevent confusion.
- Keep messages concise: Write scannable content that merchants can quickly understand without spending time deciphering meaning or next steps.
- Provide clear actions: Info, warning, and critical banners should include a call to action with specific next steps so merchants know how to proceed.
- Make dismissible when appropriate: Allow merchants to dismiss banners unless immediate action's required. Avoid persistent banners that can't be closed.
- Position contextually: Place banners outside sections for page-wide messages or inside sections for contextual messages relevant to specific content.
Anchor to LimitationsLimitations
- The dismissed state doesn't persist across page loads or sessions. You must implement your own persistence logic using local storage, cookies, or server-side state.
- Multiple banners stack vertically without built-in prioritization or queueing. If you show multiple banners at once, all appear simultaneously. You must implement banner queueing logic yourself to show one at a time.
- Banners can't be fixed or sticky at the top of the viewport. They scroll with page content.
- Banners don't have built-in truncation or "read more" functionality. Very long banner messages will wrap to multiple lines, creating tall banners that dominate the screen.