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. Use Dialog or 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.Content to default, outline, or invert. When
omitted, keycaps use invert if the tooltip’s variant is invert, and default otherwise.
Delays and grouped tooltips#
openDelay (default 600 ms) waits before opening from hover or focus, and closeDelay (default
200 ms) lets the pointer move from the trigger onto the content without closing it. Set either to
0 for no delay. After one tooltip closes, any tooltip in the same document opens without
openDelay for skipDelay (default 300 ms), so moving across a toolbar does not wait on every
button; set it to 0 to disable the grace period. placement defaults to 'top', and gutter
defaults to 4 px.
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. Pressing the trigger dismisses the tooltip so a click does not leave it open.
Examples#
Explain a labeled command#
Hover or focus Deploy History for a longer description. The button already has a visible name.
Show a save shortcut#
kbds is display-only. Pair it with a labeled Save control.
Label editor toolbar shortcuts#
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 the Tooltip component. Renders a <div> element by default.