Skip to content

addTooltip

addTooltip(opts): void

Defined in: components/tooltip.ts:130

Attaches a tooltip to the current element: adds hover/focus handlers via A so the tip appears when the element is hovered or keyboard-focused. The tip panel is rendered into document.body via a portal, so it is never clipped by overflow:hidden ancestors. Position is computed from the element’s bounding rect and automatically flips when near the viewport edge.

TooltipOptions

void

S.button(() => {
A("#Save");
S.addTooltip({ tip: "Saves your work to the cloud" });
});
A(" ");
S.button(() => {
A(".danger #Delete");
S.addTooltip({ tip: "Dangerous — cannot be undone", placement: "bottom" });
});