# Toaster

Supply UI 1.1.0. On top of the page.

A message that pops up and leaves by itself: "Saved". Its kind shows as a small round mark in front (none for `show`); the words stay in the text colour. It has no close button: it goes after five seconds, or is swiped away, and a thin ring round its mark runs down with the time left (it waits while the pointer or focus is on the stack, or the window is in the background). Anything the person must not miss is an `Alert`, never a toast that stays. `ToastMark type` draws the same mark elsewhere. `Toaster` goes once in the root layout; it also starts smooth resizing for the whole page (`startSmoothSizes`): cards and dialogs grow and shrink in the kit's movement time when their content changes, and a box of your own joins with `data-ui-smooth`. Add `action: { label: 'Undo', onClick }` for a button on it

The corner where toasts appear. Mount it once, in the layout. It also starts the page's smooth resizing (smooth-size.ts). A toast has no close button: it leaves by itself or is swiped away. A thin ring round its mark runs down with the time it has left, so the person sees that it goes on its own; it waits whenever the toast's timer waits (the pointer or focus on the stack, which UI SDK marks `data-expanded`, or the window in the background, marked here).

## Options

No options of its own.

## CSS parts

With the CSS in parts (`/ui/css/`), it needs: `components/button.css`, `components/loading.css`, `components/toast.css`, `components/icons.css`, `components/button-group-toggle.css`, `components/carousel-arrows.css`, besides the ones every page loads.

## On top of the page: notes

**States.** Closed, opening (fades and rises), open, closing (fades before what it changed appears: `afterClose`). While open, focus is inside and Escape closes it; when it closes, focus goes back to what opened it.

**Do**
- Name every dialog, drawer and popover (`DialogTitle`, `DrawerTitle`, or `aria-label`).
- Use `AlertDialog` for anything that cannot be undone, with the action named on its button ("Delete 3 files").
- Use a `Drawer` on a phone for what a `Popover` does on a computer.

**Don't**
- Don't open a dialog from a dialog; change what the open one shows instead.
- Don't put the only way to do something in a right-click menu or a tooltip.
- Don't use a toast for something the person must not miss: that is an `Alert` on the page.
