# 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

- 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 | Default | Description |
| --- | --- | --- | --- |
| `color` | `BannerColor` | `'neutral'` | `neutral`, `warning`, `negative` or `positive`. |

### 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>
```

## Related

- [Card](/docs/components/card.md)
- [Badge](/docs/components/badge.md)
