Skip to content
Mosaic
On this page

Banner

A tinted strip with a status message inside content: info, warning, error or success. Banner.Root draws the icon for its color.

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

GuidancePractice
DoPass 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’tUse it for a form-level error on a card. Use Card.Banner instead.
Don’tRender 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

PropTypeDescription
colorBannerColorneutral, 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

TSX
<Banner.Root color='negative' role='alert'>
  <Banner.Label>{m.paymentFailed}</Banner.Label>
  <Banner.Description>{m.renewNow}</Banner.Description>
</Banner.Root>