Tooltip · hints
Tooltips that wait a moment, then open at once along a toolbar — placed and flipped to fit, with an arrow at the trigger, titles and shortcuts, light and coloured looks, interactive content, click and controlled modes.
Sides · hover, or Tab to a button
A toolbar · after the first, the next open at once
Looks · titles · long text · interactive
Click · controlled · on a disabled button · inside a box that clips
Usage
import { Tooltip } from "./components/tooltip.js"; // wraps any trigger; hover waits a moment, keyboard focus shows it at onceTooltip({ text: "Copies to clipboard", children: Button({ label: "Hover me" }) }) // placement "top" · "right" · "bottom" · "left" (flipped / shifted when there's no room)Tooltip({ text: "Bold", shortcut: ["⌘", "B"], placement: "bottom", children: iconButton })Tooltip({ title: "Auto-save", text: "Saved as you type.", variant: "light" | "danger" | "success" }) // the pointer can move onto it; opened by a click; driven by a signalTooltip({ interactive: true, content: html`… <a href="/access">Ask</a>`, children })Tooltip({ trigger: "click", text: "…", children })Tooltip({ trigger: "manual", open: shown, text: "…", children })// it lives in a layer of its own, so overflow: hidden doesn't cut it off; Esc closes it