ui-kit0.0

Overlays

Tooltip

Short supporting text on hover and focus.

Usage

Wrap a group of tooltips in TooltipProvider, then compose Tooltip, TooltipTrigger and TooltipContent. Hover a button for a moment, or Tab to it: the bubble appears next to it. Move along the toolbar and the next tooltips open at once.

When to use

  • Naming an icon-only button, or showing its keyboard shortcut.
  • One short line of supporting text that is nice to have, never essential.

Not for: anything interactive or long (use a popover), anything touch users must read (tooltips never open from touch), or errors and instructions (put them on the page).

Placement

placement picks the preferred side; the tooltip flips to the opposite side when there is no room and shifts to stay inside the viewport. Add shortcut for a key hint.

API

TooltipProvider

PropTypeDefaultDescription
delayDurationnumber700Hover delay before a tooltip opens, ms.
skipDelayDurationnumber300After one closes, moving to another within this window opens it with no delay.

Tooltip

PropTypeDefaultDescription
openboolean—Controlled open state.
defaultOpenbooleanfalseInitial state when uncontrolled.
onOpenChange(open: boolean) => void—Called when the tooltip asks to open or close.
delayDurationnumber—Overrides the provider’s hover delay for this tooltip.

TooltipContent

PropTypeDefaultDescription
placement'top' | 'right' | 'bottom' | 'left' (+ '-start' | '-end')'top'Preferred side and alignment.
offsetnumber6Gap to the trigger, px.
shortcutReactNode—A key hint shown inside the bubble.

TooltipTrigger renders a button; pass asChild to use your own element. A disabled button emits no pointer events, so wrap it in a span and make the span the trigger.

Keyboard

KeyAction
TabFocusing the trigger with the keyboard opens the tooltip at once.
EscCloses the tooltip.

Accessibility

  • The bubble has role="tooltip" and the trigger points at it with aria-describedby while it is open.
  • Opens on keyboard focus but not on a pointer click, and never from touch.
  • Hoverable: the pointer can move onto the bubble without it closing (WCAG 1.4.13); Esc dismisses it.
  • Closes on scroll, pointer down and blur.

Motion

  • Open: a tiny pop from the trigger, scale .96 with a light blur (150ms, ease-out).
  • Close: 100ms fade. Inside the skip window the next tooltip appears with no delay.
  • Reduced motion: it appears and disappears without movement.