Tooltip

To build in the app

Canon tooltip from the catalog's rt-tooltip: level 1 of the disclosure ladder, a read-only line of text that hover or keyboard focus reveals and Escape dismisses. Inverted panel (stone-dark on a 2px mustard border, brutalist-sm shadow) with a matching arrow. Built on Radix Tooltip with a Provider per instance; the catalog's text-sm is text-ui-sm here. Icon-only Buttons carry one automatically from their title. The canon points this at the floating-tooltip controller, which has no arrow or border (conflict 16, see HANDOFF).

App: Ui::TooltipComponent (to build)

Four sides

#sides

Hover or focus a trigger. The arrow rotates with the side; the panel flips when it would leave the viewport.

Start and end alignments

#alignments

-start and -end align the panel's edge with the trigger's; the arrow stays on the trigger, 8px clear of the corners.

Delays

#delays

The hover delay defaults to 300ms. Keyboard focus never waits.

Longer text with max_width

#max-width

Text stays on one line unless max_width is set, then it wraps at that width.

Payment terms:

On an icon-only Button

#icon-only-button

Icon-only Buttons carry a tooltip automatically: the title is the text, placement bottom. Any other trigger takes an explicit Tooltip.

On a disabled button

#disabled-trigger

A disabled button emits no pointer events, so the trigger is a focusable span around it. Disabled still explains why (principle P8). Icon-only Buttons do this themselves.

Props

NameTypeDefaultNotes
textstring—Required. The tooltip line
placementtop | top-start | top-end | bottom | bottom-start | bottom-end | left | left-start | left-end | right | right-start | right-endtopFloating UI placement, mapped to Radix side + align. Flips and shifts on collision (8px padding)
offsetnumber8Px between the trigger and the panel; the 6px arrow sits in the gap
delaynumber300Hover delay in ms. Focus shows it at once
max_widthnumber—Px. Sets max-width and lets the text wrap (otherwise nowrap)
childrenReactElement—One focusable element that forwards ref and props (rendered with Radix asChild). Wrap a disabled control in <span tabIndex={0}> so it still explains itself