# Toast

> A short message that something happened, with one thing you can do about it. Badge's dot, the words and a Borderless Button, on a floating plate.

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

## Install

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

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

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 |
|---|---|---|---|
| `tone` | enum | `default` `positive` `warning` `negative` | `default` |
| `children` | slot |  |  |
| `action` | slot |  |  |
| `dismissible` | boolean |  | `false` |

## Anatomy

- `root`: A row: the dot, the words, the action. 56px tall, Input's height, so a Borderless Button fits with 4px around it.
- `badge`: A small Badge, as it is: the 24px frame with the dot in the tone's colour.
- `message`: Paragraph type in the main text colour, 8px clear of the action or the edge.
- `action`: A Button with `variant="Borderless"`, as it is.
- `close` (optional): An IconButton with `variant="tertiary"`, as it is: 48px, so it sits in the 56px plate with 4px around it, like the action.
- `close-glyph` (optional): Input's clear icon, 16px, in the IconButton's own icon colour.

## When to use

- **Something happened.** Saved, sent, paid, deleted. Say it in a few words, and offer Undo when you can.
- **Something failed in the background.** A sync that didn't go through. `negative`, with Retry.

## When not to use

- **Something to decide.** If they have to answer, that's **Dialog**.
- **A problem with the screen in front of them.** An error in a form belongs next to the field, or in an **InlineBanner** at the top.

## Behaviour

A floating plate with Badge's dot, the message and at most one Borderless Button. Toast draws it; the app decides where it sits (bottom centre is a good default) and for how long. Five seconds is enough for a line; keep it up while a pointer is over it. With `onClose` it gets a close button at the end, for a message that should stay until it's read. Several at once go in a **ToastStack**, newest at the bottom, 8px apart.

## Accessibility

- **Element**: A `<div role="status">`, or `role="alert"` when it's `negative`, so screen readers say it without moving focus.
- **Name**: The message is what's read. Don't rely on the dot's colour: the words say whether it worked.
- **Keyboard**: The action is a Button and takes Tab like any other. Don't make it the only way to do the thing: Undo should be in the page too.
- **Colour**: The message is 14:1 on the plate in dark.

## Content

Past tense, short, no full stop: "Invoice sent", "Couldn't sync, check your connection".

## Tokens

Every token this component uses, across all its variants.

| Token | Resolves to |
|---|---|
| `font-family/base` | `'General Sans Variable'` |
| `shadow/floating` | `0px 16px 24px 0px rgba(0, 0, 0, 0.16)` |
| `spacing/gap/2xsmall` | `4px` |
| `spacing/gap/small` | `8px` |
| `spacing/gap/small-medium` | `12px` |
| `spacing/outline/small` | `1px` |
| `spacing/radius/medium` | `12px` |
| `spacing/size/2xsmall` | `16px` |
| `spacing/size/large` | `56px` |
| `toast/background` | `#171717` |
| `toast/edge` | `#3a3a3a` |
| `toast/message` | `#ededed` |
| `typography/paragraph/font-size` | `14px` |
| `typography/paragraph/font-weight/regular` | `400` |
| `typography/paragraph/letter-spacing` | `0px` |
| `typography/paragraph/line-height` | `20px` |

## No token, on purpose

| Part | Property | Value | Why |
|---|---|---|---|
| `root` | `outline-offset` | `calc(-1 * var(--spacing-outline-small))` | Composed from a token: the edge sits inside the plate. |
| `close-glyph` | `mask` | `url(./icon-clear.svg) center / contain no-repeat` | The icon file itself. |

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