Skip to the page
TACTILE UI

Kit part · Dialogs

Dialog

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

Element
<dialog>
Needs
kit.css
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

Confirm

Remove the heat pump?

Its schedule goes with it.

Keep itRemove
Destructive
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

PartOpenDestructiveFocus on the act
Dialog

Confirm

Erase reel 3?

The take and its 14 markers go.

Confirm

Remove the heat pump?

Its schedule goes with it.

Confirm

Erase reel 3?

The take and its 14 markers go.

Graphite

PartOpenDestructiveFocus on the act
Dialog

Confirm

Erase reel 3?

The take and its 14 markers go.

Confirm

Remove the heat pump?

Its schedule goes with it.

Confirm

Erase reel 3?

The take and its 14 markers go.

03

API

NameKindValuesWhat it does
.tui-dialogclasson <dialog>A face plate up to 440px wide, 24px inside, raised high off the desk.
.tui-dialog__actionsclasson <form method="dialog">Keys right-aligned, 24px under the text.
showModal() · close()methodnativeOpens modally with a backdrop, traps focus, returns it on close.
returnValuepropertynativeThe value of the key that closed it.
close · canceleventnativeAfter it closes; cancel on Escape.
Escapekeyboard—Closes it, as native.
04

Markup

<button class="tui-key" id="erase">Erase reel 3</button>

<dialog class="tui-dialog" id="erase-dialog" aria-labelledby="erase-t">
  <p class="tui-label">Confirm</p>
  <h2 class="tui-h3" id="erase-t">Erase reel 3?</h2>
  <p class="tui-muted">The take and its 14 markers go. The mix you exported yesterday stays.</p>
  <form method="dialog" class="tui-dialog__actions">
    <button class="tui-key tui-key--flat" value="keep">Keep it</button>
    <button class="tui-key tui-key--primary" value="erase">Erase reel</button>
  </form>
</dialog>
const dialog = document.getElementById('erase-dialog');
document.getElementById('erase').addEventListener('click', () => dialog.showModal());
dialog.addEventListener('close', () => {
  if (dialog.returnValue === 'erase') eraseReel(3);
});

Needs kit.css only, no script. How to install the kit.

05

Accessibility

  • Native <dialog> with showModal(): focus moves in, is trapped, and returns to the opening key.
  • Name it with aria-labelledby pointing at the question.
  • Put the flat key first, so the safe choice is reached first.
06

How it’s built

The browser’s own dialog, dressed: the face token, a high soft shadow, 14px corners and a ::backdrop of the desk colour. It arrives with the kit’s rise (220ms, 8px, a fade), which reduced motion turns off.

07

Rules

dialog.rules.mdIn the brain

The title is a question; one sentence says what happens; a flat key backs out.

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
Preset saved.

Toast

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

Key

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

Field

Text entry in a recess, the label printed above it, and a hint that says how to fix an error.

Docs
Finish
Volume