Icon key
A key with an icon and no words, square or round: transport, power, the small tools. Its aria-label names it; a tip shows the name.
Kit part · Icons
The kit’s glyphs as one set: drawn on a 16 grid with a 1.6 line, round ends, in currentColor, so an icon prints in whatever ink it sits in, in either finish.
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 | Rest | Hover | Pressed | Focus |
|---|---|---|---|---|
| Grid cell |
Graphite
| Part | Rest | Hover | Pressed | Focus |
|---|---|---|---|---|
| Grid cell |
| Name | Kind | Values | What it does |
|---|---|---|---|
| .tui-icon | class | on <svg> | A 16px box, inline, aligned to the text’s lower line; color inherits, so the icon takes the ink it stands in. |
| --sm · --lg · --xl | class | 12 · 20 · 24 px | Sizes. The line scales with the box and stays a tenth of it. |
| viewBox="0 0 16 16" | attribute | the grid | Every glyph is drawn inside a 2 unit margin, so a set of them is optically level. |
| fill="none" stroke="currentColor" stroke-width="1.6" | attribute | on the <svg> | The line: 1.6 on the 16 grid, round caps and joins. A dot is the only filled mark. |
| aria-hidden="true" · role="img" aria-label | attribute | — | Hidden when beside words; an image with a name when the glyph is the whole message. |
| icon(name, { size, label, cls }) | function | kit.mjs | The <svg> for one glyph. Decorative unless a label is given. An unknown name returns an empty string. |
| ICONS · ICON_NAMES | object · array | kit.mjs | The set: each name to the inside of its <svg>. 42 glyphs. |
| .tui-icon-grid · __cell | class | — | The set laid out as printed cells, a glyph above its name. Cells are keys: press to copy. |
| data-size | attribute | "12" · "16" · "20" · "24" | On a grid: scales every glyph in it. |
<!-- Beside words: decorative, so it is hidden from screen readers -->
<button class="tui-key">
<svg class="tui-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor"
stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<circle cx="7" cy="7" r="4.2"/><path d="m10.2 10.2 3.3 3.3"/>
</svg>
Search
</button>
<!-- Alone, carrying the meaning: an image with a name -->
<svg class="tui-icon" viewBox="0 0 16 16" … role="img" aria-label="Warning">…</svg>
<!-- In an icon key: the button is named, the glyph is not -->
<button class="tui-key tui-key--icon" aria-label="Copy" data-tip="Copy">…</button>import { icon, ICONS, ICON_NAMES } from '/kit/kit.mjs';
button.insertAdjacentHTML('afterbegin', icon('search')); // aria-hidden
link.insertAdjacentHTML('beforeend', icon('external', { size: 'sm' }));
status.innerHTML = icon('warning', { label: 'Warning' }); // role="img"
ICON_NAMES.length; // 42
ICONS.check; // '<path d="m3.5 8.6 3 3 6-6.6"/>' the inside of the <svg>Needs kit.css and kit.mjs. How to install the kit.
aria-hidden="true", so the words are read once. An icon that stands alone is role="img" with a label that says what it means, not what it looks like.aria-label), and the glyph stays hidden.Every glyph is a few strokes on a 16 × 16 grid with a 2 unit margin, drawn with one line weight (1.6), round ends and joins, and no fill except a dot. The set is data, not sprites: ICONS maps a name to the inside of the SVG and icon() wraps it in the same attributes every time, which is what keeps a page of them level. The sidebar’s category glyphs are the same hand on a 20 grid with a 1.5 line (97 of them, from app/icons.mjs), shown here beneath the interface set.
One hand, one line weight, no colour: an icon is beside words or in a key, and it is named where it stands alone.
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 key with an icon and no words, square or round: transport, power, the small tools. Its aria-label names it; a tip shows the name.
Every button, and every link that acts like one: a cap on a skirt that drops below the plate when pressed.
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.