Banner
A message across a screen or a section, in a tone, with an optional action and a dismiss button.
Stability: experimental
Props
| Prop | Type | Default | Means |
|---|---|---|---|
title | string | What happened, in a few words. | |
message | string | More about it, under the title. | |
tone | "info" | "success" | "danger" | info | Its colour and icon; a danger banner is announced at once. |
action | string | The label of a button under the message. | |
onAction | () => void | Runs when the action is pressed. | |
onDismiss | () => void | Shows a dismiss button, and runs when it is pressed. |
States
| State | Looks like |
|---|---|
default | A tinted panel with the tone's icon, the title and message, and its action. |
Accessibility
| role | status, or alert for the danger tone |
| name | Its title and message are read as text. |
| focus | Tab reaches the action, then the dismiss button. |
| keyboard | Enter and Space press them. |
Theme tokens
color.primary color.success color.danger color.surface color.border color.ink color.muted space.1 space.3 space.4 radius.full text.label text.caption
Example
<Banner title="You are offline" message="Changes are saved on this phone." tone="danger" />