Skip to the page
TACTILE UI

Kit part · Toasts

Toast

A confirmation after an action: a small plate with a lamp and one factual sentence, read out politely, gone in 3.6 seconds.

Element
toast()
Needs
kit.css + kit.mjs
Rules
dialog.rules.md · 3
Finishes
Aluminium · Graphite · Porcelain · Black
Volumes
Tactile · Quiet
On this page
  1. Variants
  2. Every state, at once
  3. API
  4. Markup
  5. Accessibility
  6. How it’s built
  7. Rules
  8. Related parts
01

Variants

Preset saved to Studio A.
Green · done
Disk 82% full.
Amber · heads-up
02

Every state, at once

Both finishes, side by side. Hover, pressed and focus are forced with .is-hover, .is-down and .is-focus; checked and disabled are real.

Aluminium

PartGreenAmberRed
Toast
Preset saved.
Disk 82% full.
Recording.

Graphite

PartGreenAmberRed
Toast
Preset saved.
Disk 82% full.
Recording.
03

API

NameKindValuesWhat it does
toast(text, options)functionkit.mjsShows a plate and returns it.
options.lampoption"green" · "amber" · "red" · "blue" · "white"The lamp. Green by default.
options.msoption3600How long it stays before it leaves.
.tui-toastsclasscreated onceThe stack, bottom right, role="status", aria-live="polite".
.tui-toast · .is-leavingclass—The plate, and its 200ms exit.
04

Markup

<button class="tui-key" id="save">Save preset</button>
import { toast } from '/kit/kit.mjs';

document.getElementById('save').addEventListener('click', () => {
  toast('Preset saved to Studio A.');
});
toast('Disk 82% full: archive old takes.', { lamp: 'amber' });
toast('Recording to reel 4.', { lamp: 'red', ms: 5000 });

Needs kit.css and kit.mjs. How to install the kit.

05

Accessibility

  • Toasts go into one role="status" region with aria-live="polite", so they are read after the current sentence.
  • They leave on their own: never put a decision or an error that needs action in one. Use a dialog, or a hint on the field.
06

How it’s built

Twenty lines in kit.mjs. The first call creates the live region; each call appends a plate with a lamp and a text node (never HTML), then removes it after ms. It rises with the kit’s 220ms rise.

07

Rules

dialog.rules.mdIn the brain

One factual sentence with a lamp, and never a toast for an error that needs action.

3 rules in this file, with the foundations they rest on and the anti-patterns that break them. Full rules ship in the brain with the Pass.

08

Confirm

Erase reel 3?

KeepErase

Dialog

A decision that must be made now: a native dialog with a question, one sentence of consequence, a way back and the act.

Lamp

The only colour in the kit: a lamp that is on. Green is on, amber is waiting, red is recording or failing, blue is linked, white is standing by. Always next to words.

Key

Every button, and every link that acts like one: a cap on a skirt that drops below the plate when pressed.

Docs
Finish
Volume