Skip to content

Rich Tooltips

TheGenieOfTheCode edited this page Oct 29, 2026 · 1 revision

Rich Tooltips

Tooltips in the Draw Steel system's own item layout: a name, a small category tag, and a line or two on what the thing does. A tooltip inside a chat message, or anywhere in a chat log, opens beside the chat instead of on top of the message. Elsewhere Foundry places it as usual.

Every module in the family uses these, so a tooltip looks the same wherever it comes from. CTLib handles the hover itself, including popped out and detached chat windows.

Making one

const { setTip, tipAttrs, richTip, tipFrom } = ctlib;

setTip(button, { title: 'Undo Mark', category: 'Mark', body: 'Removes the mark this row applied.' });
Function What it does
setTip(el, spec) Gives an element a rich tooltip. It removes any plain data-tooltip or title the element had, so Foundry doesn't show both. Setting it again updates an open tooltip in place.
tipAttrs(spec) The same as HTML attributes, for markup built as a string.
richTip(spec) The tooltip's HTML on its own.
tipFrom(prefix, options) A spec read from your lang file: ${prefix}.title, ${prefix}.category and ${prefix}.body. Pass title, category or body to override one, and data for {placeholders}.

A spec is { title, category, body }, or { title, category, html } when the body needs markup. body is escaped; html is not, so escape anything you put in it.

Templates

<button type="button" {{richTip "MYMOD.tip.save" title=label}}>

richTip takes a lang prefix like tipFrom, with title, category and body as overrides. Any other option fills placeholders in the strings.

Converting old tooltips

Function What it does
richifyTooltips(root, { category }) Upgrades every plain data-tooltip inside root. The element's own label becomes the name and the old tooltip the body; a tooltip that starts with a <strong> line uses that line as the name. Call it on a window's content after it renders, not on the whole window, so Foundry's header buttons keep their own tooltips.
textTip(text, { label, category }) The same conversion for a single tooltip string, as a spec for setTip.
pillTip({ title, category, src, hint }) A modifier pill's tooltip: what it is, where it came from, and what clicking it does.

TIP_CLASS is the class pair the tooltip carries, draw-steel dsct-rich-tip, if you want to style your own section of it.

Related Pages

Clone this wiki locally