# Banner

> A notice across the top of a page or a section: what happened, a line on what to do, and maybe a way to do it. In four statuses, on a tint of the status's colour.

| | |
|---|---|
| Kind | component |
| Contract | `review` · [banner.contract.yaml](https://github.com/Runceanu/rost/blob/master/contracts/banner.contract.yaml) |
| Guidance | `proposed` |
| Source | [Figma 780:54](https://www.figma.com/design/1Zy0wiWKXQAvsfDBX3KR0d/UI-Kit-v01?node-id=780-54) · read 2026-11-30 · frozen 2026-11-30 |
| Implemented in | nowhere yet |

## Install

It lands in `src/rost/banner/`, with what it needs and its contract:

```sh
npx github:Runceanu/rost add banner
```

Then import `src/rost/fonts.css` and `src/rost/tokens.css` once, at the root of the app. More on this in [Install](https://rost.build/docs/install.md).

## Props

| Prop | Type | Values | Default |
|---|---|---|---|
| `status` | enum | `Default` `Negative` `Positive` `Warning` | `Default` |
| `title` | slot |  |  |
| `description` | slot |  |  |
| `actions` | slot |  |  |
| `onDismiss` | node |  |  |

## States

`Default` · `DismissHover` · `DismissFocus`

## Anatomy

- `root`: The strip: 16px in all round, 12px between its parts, Input's 12px corners. As wide as what it sits on top of.
- `icon` (optional): InlineBanner's 20px glyph for the status, in its colour. Default has none.
- `body`: The words, filling the rest of the line.
- `title`: Paragraph type at medium weight, in the primary colour.
- `description` (optional): Paragraph type, a step quieter.
- `actions` (optional): The links, in a row that wraps, 4px more below the words.
- `dismiss` (optional): A 24px round button with Input's clear glyph, on the right, at the top.
- `dismiss-glyph`: Input's clear glyph, 16px, in the description's colour.

## When to use

- **Something about the whole page.** A card that was declined, a bank that needs connecting again, a tax year that closes on Friday. Above everything it's about.

## When not to use

- **About one field or one row.** Put an **InlineBanner** next to it instead, or the field's own error.
- **Something that just happened.** A save, a send: that's a **Toast**, and it goes away by itself.

## Behaviour

It stays until it's dismissed or the thing it's about is fixed. With `onDismiss` it has a close button; without it, it can't be closed, which is right for a problem that's still there. Dismissing it is the app's to remember.

## Accessibility

- **Element**: `role="status"`, so a screen reader reads it when it appears, after what it's saying; Negative is `role="alert"`, read straight away. The icon is decoration: the title says what it is.
- **Name**: The close button says Dismiss.
- **Keyboard**: Tab reaches the links, then the close button.
- **Focus**: Each link's own ring; the close button's 2px ring on `:focus-visible`.
- **Colour**: The words are 11:1 or better on every tint, in both themes.

## Content

A title that says what happened, not the status: Your card was declined, not Error. The description says what to do.

## Tokens

Every token this component uses, across all its variants.

| Token | Resolves to |
|---|---|
| `banner/default/background` | `#171717` |
| `banner/description` | `#d3d9d5` |
| `banner/dismiss-hover` | `#3a3a3a` |
| `banner/negative/background` | `#48050c` |
| `banner/negative/icon` | `#f2705f` |
| `banner/positive/background` | `#004c19` |
| `banner/positive/icon` | `#00d669` |
| `banner/title` | `#ededed` |
| `banner/warning/background` | `#492604` |
| `banner/warning/icon` | `#fda50d` |
| `font-family/base` | `'General Sans Variable'` |
| `spacing/gap/2xsmall` | `4px` |
| `spacing/gap/medium` | `16px` |
| `spacing/gap/small-medium` | `12px` |
| `spacing/radius/full` | `10000px` |
| `spacing/radius/medium` | `12px` |
| `spacing/size/2xsmall` | `16px` |
| `spacing/size/small` | `24px` |
| `spacing/size/xsmall` | `20px` |
| `typography/paragraph/font-size` | `14px` |
| `typography/paragraph/font-weight/medium` | `500` |
| `typography/paragraph/font-weight/regular` | `400` |
| `typography/paragraph/letter-spacing` | `0px` |
| `typography/paragraph/line-height` | `20px` |

## No token, on purpose

| Part | Property | Value | Why |
|---|---|---|---|
| `dismiss-glyph` | `mask` | `url(./icon-close.svg) center / contain no-repeat` | The icon file itself. |
| `icon` | `mask` | `url(./icon-alarm.svg) center / contain no-repeat` | InlineBanner's glyph. The colour is the token. |
| `icon` | `mask` | `url(./icon-positive.svg) center / contain no-repeat` | InlineBanner's glyph. The colour is the token. |
| `icon` | `mask` | `url(./icon-warning.svg) center / contain no-repeat` | InlineBanner's glyph. The colour is the token. |
| `dismiss` | `outline` | `var(--spacing-outline-medium) solid var(--banner-focus-ring)` | Composed from tokens: a 2px ring in banner/focus-ring. |

See it live, with every value of every variant: [rost.build/components/banner/](https://rost.build/components/banner/)
