Overlays

Tooltip

Deletes the largest file in v0 — three state variables, four refs, three effects, hand-rolled viewport clamping and a manually managed portal container. The trigger wraps your element rather than cloning props onto it.

data-scope="tooltip"

What you get for free

  • Anchor positioning with collision handling
  • Open/close delays with a shared group timer
  • Correct aria-describedby wiring

Usage

<Tooltip title="Copy to clipboard" placement="top">
  <Button icon="copy" aria-label="Copy" />
</Tooltip>
<Tooltip content="Copy to clipboard" placement="top">
  <Button icon="copy" aria-label="Copy" />
</Tooltip>
<Tooltip content="Copy to clipboard" placement="top">
  <Button icon="copy" aria-label="Copy" />
</Tooltip>
<ck-tooltip content="Copy to clipboard" placement="top">
  <button ckButton icon="copy" aria-label="Copy"></button>
</ck-tooltip>

Props

PropTypeDefaultNotes
titleReactNodeReact firstThe tooltip text. An empty one never opens, so `title={row.note}` is safe without a conditional around it.
contentReactNodeNot in ReactTooltip body. v2 React: `title`.
placementPlacement | PlacementAlias"top"Accepts the canonical names and all twelve camelCase ones (topLeft, rightBottom, …).
trigger"hover" | "focus" | "click" | Array<…>["hover", "focus"]React firstFocus is in the default because a tooltip only a pointer can reach is not a tooltip.
mouseEnterDelaynumber0.1React firstSECONDS, not milliseconds.
mouseLeaveDelaynumber0.1React firstSECONDS. Also the window in which moving onto the popup keeps it open.
openDelaynumberNot in Reactv0: showDelay. v2 React: mouseEnterDelay.
closeDelaynumberNot in Reactv0: hideDelay. v2 React: mouseLeaveDelay.
openbooleanControlled. v0: visible.
disabledbooleanfalseNever opens.
colorstringReact firstAny CSS colour. Drives the box and its arrow from one value.
overlayClassNamestringReact firstClass on the popup rather than the trigger.
contentClassNamestringNot in ReactClass on the content. v0: overlayClassName. v2 React: overlayClassName.

Prop names are identical in all four frameworks. Only two-way binding differs, and each framework uses its own idiom over the same underlying prop. The marked rows are the exception, and a temporary one, in both directions: React first exists in React while the other three adapters catch up, and Not in React is the prop it replaced, still live everywhere else.

Migrating from react-ui-toolkit

v0v1Notes
visibleopen
showDelay / hideDelayopenDelay / closeDelay
overlayClassNamecontentClassName
contentClassNameoverlayClassNameReact only, and back to the name v0 had: the prop names the popup, and `content` is what goes in it.
contenttitleReact only. Frees `content` for Popover, where a title and a body are different things.
cloneElement onto your triggera wrapper element with display: inline-flexThe trigger handlers are pointerenter/pointerleave and focus/blur — none of which bubble — so a box-less wrapper would have worked in React and silently failed everywhere else.