A small round key beside a label that, when pressed, hangs a sentence or two about it on a label plate and says them aloud. The tooltip names a key on hover and never opens on touch; a toggletip is for words a person may need to read before they choose, so it opens on a press, on a phone as on a desk, and stays until it is pressed again, Escape is pressed, a press lands outside it or focus moves on. The note is written into a polite status line as it opens, so a screen reader hears it once. Without the script the note is printed in place after the label.
Element
<tui-toggletip label="About the billing day">
Needs
kit.css + kit.mjs
Covers
Toggletip · Info tip
Rules
toggletip.rules.md · 8
Finishes
Aluminium · Graphite · Oak · Walnut · Porcelain · Black · Daylight · Night · Paper · Phosphor · E-paper · AMOLED
The key’s name, the note as one line, and the element as markup (static draws it open, for a specimen).
.tui-toggletip__key · .tui-toggletip__card
class
drawn
The key (22px, with a 44px press) and the plate.
Markup
<label class="tui-label" for="billing-day">Billing day</label>
<tui-toggletip label="About the billing day">
Your card is charged on this day each month. A change counts from the next bill.
</tui-toggletip>
<select class="tui-select" id="billing-day">…</select>
<!-- The question mark, and a note that hangs below its key: -->
<tui-toggletip label="What is a seat?" icon="question" side="bottom">A seat is one person who can sign in.</tui-toggletip>
<!-- It writes its own key, the plate and a status line; the words inside are the note. -->
import '/kit/kit.mjs';
const tip = document.querySelector('tui-toggletip');
tip.show(); // or tip.open = true
tip.hide();
tip.note = 'Charged on the 1st.'; // new words; an open note says them again
tip.addEventListener('tui-toggletip', (e) => console.log(e.detail.open));
The key is a real button with aria-expanded, named by label; Enter and Space open and close it, as a press does.
The plate is decoration for the eyes (aria-hidden): the note is written into a role="status" line a moment after it opens, so a screen reader says it once, politely, and it is taken out again as the plate closes.
Escape closes it and keeps focus on the key; tabbing on, or a press anywhere else, closes it too. Nothing inside it takes focus, so it holds no link and no key: what needs a press belongs in a popover.
It opens on a press, so it works with touch, a switch or voice control the same as with a mouse; the key is drawn at 22px beside a label, but its press is 44px across.
The plate is the tooltip’s contrast plate, so the words hold the kit’s contrast in every finish and both volumes. Its fade is the only motion, and reduced motion leaves it out.
How it’s built
The key is the kit’s round icon key, small, with the icon set’s info or question mark, and it stays down while the note is out. The plate is the tooltip’s label plate grown to a sentence or two, with its printed rule and its tab, placed by the popover’s own placement so it flips and slides like every card in the kit. It sits in the top layer as a manual popover, so no box clips it. No colour is added.
Rules
toggletip.rules.mdIn the brain
A press-to-read note beside a label: a sentence or two that explains a setting, said aloud as it opens.
8 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 few words on a small label plate, the kind riveted beside a control on a rack: printed in the contrast colours with a rule just inside its edge and a short tab aimed at its key. It comes up when a pointer rests on the key or the keyboard reaches it, is read by a screen reader, and goes on Escape.
A preview that hangs from a link when the pointer rests on it or the keyboard reaches it. The popover’s card and leader, opened by a short delay and put away by leaving.