Tooltip
Show supplemental, non-interactive information on hover or focus.
Anatomy#
Content is portaled into an internal positioning wrapper.
Usage#
Use Tooltip for supplemental information on hover or focus. Use Popover when the content is interactive, or Dialog and Sheet for a task that should take over the page.
Do not rely on tooltip text as the only accessible name of a control: the trigger needs its own
name, such as visible text or aria-label. The trigger references the content through
aria-describedby.
Text and content#
Pass plain text or JSX as children of Tooltip.Content. String children render in the text slot;
other children render directly inside the content. Set variant="invert" on Tooltip to flip the
colors.
Triggering and shortcuts#
Tooltip opens from pointer hover and keyboard focus. kbds displays shortcut notation after the
hint; it does not register that shortcut. Names such as command, ctrl, shift, and meta
render as symbols.
Set kbdVariant on Tooltip to default, outline, or invert. When omitted, keycaps use
invert if the tooltip’s variant is invert, and default otherwise.
Delays and groups#
Configure timing and positioning on Tooltip:
openDelay(default600ms): waits before opening from hover or focus. Set to0for no delay.closeDelay(default200ms): lets the pointer move from the trigger onto the content without closing it. Set to0for no delay.skipDelay(default300ms): after one tooltip closes, any tooltip in the same document opens withoutopenDelayduring this window so moving across a toolbar does not wait on every button. Set to0to disable.placementandgutter: default to'top'and4px.
Control the open state with open and onOpenChange, or start open with defaultOpen. disabled
keeps the tooltip closed, and forceMount keeps its content in the DOM while closed.
Keyboard interaction#
Moving keyboard focus to the trigger opens the tooltip, and blurring it closes the tooltip. Escape closes an open tooltip. Pressing the trigger dismisses the tooltip so a click does not leave it open.
Examples#
Basic#
Hover or focus a trigger to reveal supplementary text.
Keyboard shortcut#
Pass kbds to display shortcut hints alongside tooltip text.
Toolbar group#
Keep icon-only controls named with aria-label. Each tooltip repeats the command and shows its
shortcut.
API Reference#
Attributes#
data-closeddata-disableddata-expandeddata-aligndata-instant-motiondata-sideProps#
Tooltip#
Trigger#
Renders a <button> element by default.
Content#
Props for `Tooltip.Content`. Renders a <div> element by default.