Overview
UseTooltip for a short explanation of a control or truncated text. Keep essential information visible, give controls an accessible name, and use Popover when the content contains links, buttons, or other controls.
Usage
children. Native elements receive the trigger attributes, event handlers, and ref directly. Custom trigger components must forward all of them. A wrapper element also works with a component that does not forward every trigger prop.
Hover opens the tooltip after delay milliseconds, which defaults to 600. Keyboard focus opens it immediately. closeDelay defaults to 0; hovering over the popup keeps it open unless disableHoverablePopup is set. Escape dismisses it.
Controlled state
Useopen and onOpenChange together when the application owns visibility. Use defaultOpen only to set the initial visibility of an uncontrolled tooltip.
Rich content and composition
Shorthand acceptsdescription and startIcon beside content. Custom node content renders as supplied unless a description or icon requests the title layout.
Tooltip.Body layout. Assemble the portal, positioning, popup and optional arrow explicitly. Popup renders its children as supplied; Body provides the same title, description and decorative icon layout as shorthand.
Tooltip.Body accepts optional title children, description and startIcon nodes. Titles use medium weight; descriptions use the secondary tooltip color, preserve line breaks and wrap long text. Omit title children for a description-only tooltip. The icon is decorative and appears only with a title. Body adds no tooltip role, popup styling, sizing or positioning. Arbitrary Popup content remains supported. Import TooltipBodyProps from twenty-ui/primitives/surfaces when typing a wrapper.
Every DOM part accepts native props, refs, and element or callback render composition. Shorthand’s top-level native props, render and ref target Popup. Use triggerProps, positionerProps and portalProps to customize the other targets; these override shorthand defaults. Children supply the default trigger render element. Both forms preserve controlled/uncontrolled Root state and Base UI callback event details, including cancellation, reason, original event and active trigger.
Tooltip.createHandle<TPayload>() connects detached triggers to either form through handle. Compound Root’s children or shorthand’s content can be a function receiving the typed active payload. Tooltip.Handle and the public TooltipHandle type expose the installed handle contract. Handles support imperative open(triggerId) and close() while their Root is mounted.
Migration
Replacecontent={<Tooltip.Content description={description} startIcon={icon}>title</Tooltip.Content>} with content={title} description={description} startIcon={icon}. In compound usage, use Tooltip.Body for the shared title and description layout or compose your own content. Tooltip.Content and TooltipContentProps are removed.
Existing compound Popup positioning props move to Positioner. Wrap it in Portal, move container and keepMounted to Portal, keep maxWidth on Popup, and replace arrow with an Arrow child. Preserve the former spacing explicitly with sideOffset={10} when needed. Compound Positioner keeps Base UI’s sideOffset={0}. Both forms cap Popup at 300 pixels by default.
Disabled controls
Native disabled buttons cannot receive keyboard focus. Wrap one in a focusable trigger so users can discover why the action is unavailable.disabled on shorthand or Root suppresses the tooltip itself. Trigger disabled suppresses that trigger’s tooltip interaction. Disable the native control through its own props or Trigger’s render element.
Placement and overflowing text
Shorthand defaults toside="top", align="center", and sideOffset={10}. Both shorthand and compound tooltips have a maximum width of 300 pixels, capped by the available space beside the anchor. Pass maxWidth to shorthand or Tooltip.Popup to choose a different maximum, including wider previews. Native popup styles remain available for custom sizing. Placement adjusts to available space. An open tooltip hides while its anchor is scrolled out of view, including out of a scroll container. Use arrow for an arrow and container to override the theme’s portal destination; see theming.
Use OverflowingTextWithTooltip when a text label should show its full value only when truncated. Its existing text, tooltipContent, and tooltipPlace props remain available.
Props
The reference is generated from the public component types. Native popup attributes and event handlers are also accepted.A ref to imperative actions.
unmount: Ends the closing phase of the tooltip after an externally controlled closing animation finishes. CallpreventUnmountOnClose()inonOpenChangefirst, otherwise the tooltip completes closing on its own. Whether it leaves the DOM is decided bykeepMountedon the portal.close: Closes the tooltip imperatively when called.
Element | VirtualElement | RefObject<Element | null> | (() => Element | VirtualElement | null) | null
An explicit positioning anchor for the popup.
A single trigger element. Custom components must forward their ref, native attributes, and event handlers.
Determines how to handle collisions when positioning the popup.
side controls overflow on the preferred placement axis (top/bottom or left/right):'flip': keep the requested side when it fits; otherwise try the opposite side (topandbottom, orleftandright).'shift': never change side; keep the requested side and move the popup within the clipping boundary so it stays visible.'none': do not correct side-axis overflow.
align controls overflow on the alignment axis (start/center/end):'flip': keep side, but swapstartandendwhen the requested alignment overflows.'shift': keep side and requested alignment, then nudge the popup along the alignment axis to fit.'none': do not correct alignment-axis overflow.
fallbackAxisSide controls fallback behavior on the perpendicular axis when the
preferred axis cannot fit:'start': allow perpendicular fallback and try the logical start side first (topbeforebottom, orleftbeforerightin LTR).'end': allow perpendicular fallback and try the logical end side first (bottombeforetop, orrightbeforeleftin LTR).'none': do not fallback to the perpendicular axis.
side is 'shift', explicitly setting align only supports 'shift' or 'none'.
If align is omitted, it defaults to 'flip'.An element or a rectangle that delimits the area that the popup is confined to.
Portal destination. Defaults to the current theme container.
Supplementary content, or a function receiving the active trigger payload. Strings and numbers use the shorthand title layout.
ID of the trigger that the tooltip is associated with.
This is useful in conjunction with the
defaultOpen prop to create an initially open tooltip.Whether to disable the popup from tracking any layout shift of its positioning anchor.
Maximum popup width. Defaults to 300 pixels and is capped by the space available beside the anchor.
Receives the requested open state and unchanged Base UI event details, including reason, event, trigger and cancel().
Event handler called after any animations complete when the tooltip is opened or closed.
Full Portal props, including native props, ref and render. Overrides shorthand portal defaults.
Full Positioner props, including native props, ref and render. Overrides shorthand placement defaults.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, TooltipPopupState>
Allows you to replace the component’s HTML element
with a different tag, or compose it with another component.Accepts a
ReactElement or a function that returns the element to render.Preferred side of the trigger. Defaults to top and may change to avoid collisions.
Whether to maintain the popup in the viewport after
the anchor element was scrolled out of view.
Inline styles for the popup.
Determines which axis the tooltip should track the cursor on.
ID of the trigger that the tooltip is associated with.
This is useful in conjunction with the
open prop to create a controlled tooltip.
There’s no need to specify this prop when the tooltip is uncontrolled (that is, when the open prop is not set).Full Trigger props, including native props, ref, render and payload. Overrides the shorthand trigger defaults.
Tooltip.Root
A ref to imperative actions.
unmount: Ends the closing phase of the tooltip after an externally controlled closing animation finishes. CallpreventUnmountOnClose()inonOpenChangefirst, otherwise the tooltip completes closing on its own. Whether it leaves the DOM is decided bykeepMountedon the portal.close: Closes the tooltip imperatively when called.
Parts or a render function receiving the active trigger payload. Root renders no DOM node.
Whether the tooltip is initially open.To render a controlled tooltip, use the
open prop instead.ID of the trigger that the tooltip is associated with.
This is useful in conjunction with the
defaultOpen prop to create an initially open tooltip.Receives the requested open state and unchanged Base UI event details, including reason, event, trigger and cancel().
Event handler called after any animations complete when the tooltip is opened or closed.
Determines which axis the tooltip should track the cursor on.
ID of the trigger that the tooltip is associated with.
This is useful in conjunction with the
open prop to create a controlled tooltip.
There’s no need to specify this prop when the tooltip is uncontrolled (that is, when the open prop is not set).Tooltip.Trigger
CSS class applied to the element, or a function that
returns a class based on the component’s state.
Disables tooltip interaction for this trigger without disabling its native element.
((((instance: HTMLButtonElement | null) => void | (() => VoidOrUndefinedOnly)) | RefObject<HTMLButtonElement | null>) & (((instance: HTMLElement | null) => void | (() => VoidOrUndefinedOnly)) | RefObject<...>)) | null
Ref to the rendered trigger element, a button by default.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, TooltipTriggerState>
Composes a native element or a component that forwards attributes, handlers and ref.
Style applied to the element, or a function that
returns a style object based on the component’s state.
Tooltip.Portal
CSS class applied to the element, or a function that
returns a class based on the component’s state.
Portal destination. Defaults to the current theme container, then the document body.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, TooltipPortalState>
Allows you to replace the component’s HTML element
with a different tag, or compose it with another component.Accepts a
ReactElement or a function that returns the element to render.Style applied to the element, or a function that
returns a style object based on the component’s state.
Tooltip.Positioner
Additional offset along the alignment axis in pixels.
Also accepts a function that returns the offset to read the dimensions of the anchor
and positioner elements, along with its side and alignment.The function takes a
data object parameter with the following properties:data.anchor: the dimensions of the anchor element with propertieswidthandheight.data.positioner: the dimensions of the positioner element with propertieswidthandheight.data.side: which side of the anchor element the positioner is aligned against.data.align: how the positioner is aligned relative to the specified side.
Element | VirtualElement | RefObject<Element | null> | (() => Element | VirtualElement | null) | null
An element to position the popup against.
By default, the popup will be positioned against the trigger.
Minimum distance to maintain between the arrow and the edges of the popup.Use it to prevent the arrow element from hanging out of the rounded corners of a popup.
CSS class applied to the element, or a function that
returns a class based on the component’s state.
Determines how to handle collisions when positioning the popup.
side controls overflow on the preferred placement axis (top/bottom or left/right):'flip': keep the requested side when it fits; otherwise try the opposite side (topandbottom, orleftandright).'shift': never change side; keep the requested side and move the popup within the clipping boundary so it stays visible.'none': do not correct side-axis overflow.
align controls overflow on the alignment axis (start/center/end):'flip': keep side, but swapstartandendwhen the requested alignment overflows.'shift': keep side and requested alignment, then nudge the popup along the alignment axis to fit.'none': do not correct alignment-axis overflow.
fallbackAxisSide controls fallback behavior on the perpendicular axis when the
preferred axis cannot fit:'start': allow perpendicular fallback and try the logical start side first (topbeforebottom, orleftbeforerightin LTR).'end': allow perpendicular fallback and try the logical end side first (bottombeforetop, orrightbeforeleftin LTR).'none': do not fallback to the perpendicular axis.
side is 'shift', explicitly setting align only supports 'shift' or 'none'.
If align is omitted, it defaults to 'flip'.An element or a rectangle that delimits the area that the popup is confined to.
Whether to disable the popup from tracking any layout shift of its positioning anchor.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, TooltipPositionerState>
Allows you to replace the component’s HTML element
with a different tag, or compose it with another component.Accepts a
ReactElement or a function that returns the element to render.Preferred physical or logical side of the anchor. Defaults to top.
Distance from the anchor. Defaults to 0 in compound usage. Accepts a number or positioning function.
Whether to maintain the popup in the viewport after
the anchor element was scrolled out of view.
Style applied to the element, or a function that
returns a style object based on the component’s state.
Tooltip.Popup
CSS class applied to the element, or a function that
returns a class based on the component’s state.
Maximum popup width. Defaults to 300 pixels and is capped by the space available beside the anchor.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, TooltipPopupState>
Allows you to replace the component’s HTML element
with a different tag, or compose it with another component.Accepts a
ReactElement or a function that returns the element to render.Style applied to the element, or a function that
returns a style object based on the component’s state.
Tooltip.Body
Optional title content, displayed with medium weight. Omit it for a description-only tooltip.
Composes the body root through an element or render callback while preserving its layout and content.
Tooltip.Arrow
CSS class applied to the element, or a function that
returns a class based on the component’s state.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, TooltipArrowState>
Allows you to replace the component’s HTML element
with a different tag, or compose it with another component.Accepts a
ReactElement or a function that returns the element to render.Style applied to the element, or a function that
returns a style object based on the component’s state.
Tooltip.Viewport
CSS class applied to the element, or a function that
returns a class based on the component’s state.
Ref to the content-transition div. Useful when several triggers share changing content.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, TooltipViewportState>
Allows you to replace the component’s HTML element
with a different tag, or compose it with another component.Accepts a
ReactElement or a function that returns the element to render.Style applied to the element, or a function that
returns a style object based on the component’s state.
Tooltip.Provider
Tooltips sharing delay, closeDelay and timeout configuration. Provider renders no DOM node.