Demos

A tooltip that names an icon button.

Usage

Use a tooltip to name an icon button or add a brief hint. Keep it to a few words. Never put information the reader needs only in a tooltip. Touch screens have no hover. For longer content or links, use a Popover.

Import it from @workspace/ui/components/tooltip.

Anatomy

  • TooltipProvider — Sets the delay and groups tooltips. Wrap your app once. Without it, a tooltip waits 600 ms before it opens.
  • Tooltip — Holds the open state.
  • TooltipTrigger — The element that shows the tooltip. Pass a button through render.
  • TooltipContent — The label and its arrow.

Notes

  • The tooltip opens on hover and on keyboard focus.
  • An icon button still needs its own aria-label. The tooltip does not name it.

Examples

Sides

Set side on TooltipContent to open on any side of the trigger.

Toolbar

One TooltipProvider around a group shares the delay. Once one tooltip is open, the next opens right away.

Props

These are the props you set most often. Unlisted props pass through to the underlying element.

TooltipProvider

PropTypeDefaultDescription
delaynumber0Milliseconds before a tooltip opens.
closeDelaynumber0Milliseconds before a tooltip closes.

TooltipContent

PropTypeDefaultDescription
side"top", "right", "bottom", "left", "inline-start", or "inline-end"topSide of the trigger to open on.
align"start", "center", or "end"centerAlignment along that side.
sideOffsetnumber4Gap from the trigger in pixels.
alignOffsetnumber0Shift along the side in pixels.
classNamestring—Classes merged onto the label.