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
| Prop | Type | Default | Description |
|---|---|---|---|
| delayDuration | number | 700 | Hover delay before a tooltip opens, ms. |
| skipDelayDuration | number | 300 | After one closes, moving to another within this window opens it with no delay. |
Tooltip
| Prop | Type | Default | Description |
|---|---|---|---|
| open | boolean | — | Controlled open state. |
| defaultOpen | boolean | false | Initial state when uncontrolled. |
| onOpenChange | (open: boolean) => void | — | Called when the tooltip asks to open or close. |
| delayDuration | number | — | Overrides the provider’s hover delay for this tooltip. |
TooltipContent
| Prop | Type | Default | Description |
|---|---|---|---|
| placement | 'top' | 'right' | 'bottom' | 'left' (+ '-start' | '-end') | 'top' | Preferred side and alignment. |
| offset | number | 6 | Gap to the trigger, px. |
| shortcut | ReactNode | — | 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
| Key | Action |
|---|---|
| Tab | Focusing the trigger with the keyboard opens the tooltip at once. |
| Esc | Closes 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.