Status
A lamp with words: the state line in tables, panel heads and lists. The words carry the meaning; the lamp is the glance.
Kit part · Badges & tags
A small legend that says whether your work is safe: Saving, Saved or Offline, with a lamp that matches (amber and blinking while it saves, green when it has, red when it cannot). The words are the state and the lamp only agrees with them. It is a polite status region, so changing its words is what a screen reader hears.
Seats open in 11 days. Want one email that morning?
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
| Part | Saving | Saved | Offline |
|---|---|---|---|
| Legend | Saving… | Saved 2 min ago | Offline |
Graphite
| Part | Saving | Saved | Offline |
|---|---|---|---|
| Legend | Saving… | Saved 2 min ago | Offline |
| Name | Kind | Values | What it does |
|---|---|---|---|
| span.tui-sync[role="status"][data-state] | element | saving · saved · offline | The legend. data-state sets the lamp’s colour and, for saving, its blink. A polite status region. |
| .tui-lamp[data-on][aria-hidden="true"] | element | the kit’s lamp | The lamp. Do not set data-lamp: the legend gives it its colour from data-state. |
| .tui-sync__text · .tui-sync__detail | element | the words · small print | The state in one word, and anything more after it: “2 min ago”, “changes kept on this device”. |
| syncText(state) | function | pure | The words for a state: “Saving…”, “Saved”, “Offline”. |
| setSync(el, state, detail?) | function | needs kit.mjs | Changes data-state and the words together, and does nothing if neither has changed, so the same words are not said twice. |
<span class="tui-sync" role="status" data-state="saved">
<span class="tui-lamp" data-on aria-hidden="true"></span>
<span class="tui-sync__text">Saved</span>
<span class="tui-sync__detail">2 min ago</span>
</span>
<!-- Change data-state to "saving" or "offline" and the words with it. -->import { setSync, syncText } from '/kit/kit.mjs';
const legend = document.querySelector('.tui-sync');
setSync(legend, 'saving'); // lamp amber and blinking, "Saving…"
await save();
setSync(legend, 'saved', 'just now'); // lamp green, "Saved just now"
setSync(legend, 'offline', 'changes kept on this device');
syncText('offline'); // 'Offline'Needs kit.css only, no script. How to install the kit.
role="status", a polite live region, so a screen reader says “Saving…”, then “Saved”, as the words change, without moving the focus or interrupting what it is reading.The status line the kit already has, with its lamp, drawn as a legend whose colour comes from one attribute. The lamp is the kit’s own, so every finish draws it as it draws any lamp, and the blink for saving is the lamp’s own blink. The words are changed by the page, and the script does no more than change the attribute and the words together.
Tell someone their work is being kept: three words and a lamp in the head of a document or the foot of a form.
5 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.
A lamp with words: the state line in tables, panel heads and lists. The words carry the meaning; the lamp is the glance.
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.
A confirmation after an action: a small plate with a lamp and one factual sentence, read out politely, gone in 3.6 seconds.
A ring of eight lamps lit in turn, a chase round a dial: each lamp is a dim cap with its light laid over it, and the light fades as the chase passes on, leaving a short tail. Only the light’s opacity moves. Amber, the lamp for work in hand. Under reduced motion it holds still on one lit lamp at the top, and the words still say it is busy.