Banner
A tinted strip with a status message inside content: info, warning, error or success. Banner.Root draws the icon for its color.
'use client';
import { Banner } from '@clerk/mosaic/components/banner';
export default function BannerExample() {
return (
<Banner.Root
color='negative'
role='alert'
>
<Banner.Label>Your payment failed</Banner.Label>
<Banner.Description>Update your card to keep your plan active.</Banner.Description>
</Banner.Root>
);
}Use for
- an inline notice inside content: info, warning, error or success
- a warning before a risky setting
- a success or error message on a page
Practices
| Guidance | Practice |
|---|---|
| Do | Pass role='status', or role='alert' for an error, when the banner appears in response to something the user did. Banner.Root sets no role. |
| Don’t | Use it for a form-level error on a card. Use Card.Banner instead. |
| Don’t | Render an icon yourself. The root picks one for its color. |
API reference
Banner.Root
The strip, with the icon (cl-banner-icon) and a content box (cl-banner-content) around its children. Renders a div.
Slot: cl-banner-root
| Prop | Type | Description |
|---|---|---|
color | BannerColor | neutral, warning, negative or positive.Default: 'neutral' |
Banner.Label
The headline, as a p. Carries the root's data-color.
Slot: cl-banner-label
Banner.Description
Supporting copy, as a p. Carries the root's data-color.
Slot: cl-banner-description
Examples
An error
<Banner.Root color='negative' role='alert'>
<Banner.Label>{m.paymentFailed}</Banner.Label>
<Banner.Description>{m.renewNow}</Banner.Description>
</Banner.Root>