Skip to content
+

Tooltip

Tooltips are visual-only floating elements that display information about a trigger element when a user hovers or focuses it.

TooltipArrow API

Import

import * as Tooltip from '@base_ui/react/Tooltip';
const TooltipArrow = Tooltip.Arrow;

Props

Props of the native component are also available.

NameTypeDefaultDescription
classNamefunc
| string
-

Class names applied to the element or a function that returns them based on the component's state.

hideWhenUncenteredboolfalse

If true, the arrow will be hidden when it can't point to the center of the anchor element.

renderelement
| func
-

A function to customize rendering of the component.


The ref is forwarded to the root element.

Theme default props

You can use TooltipArrow to change the default props of this component with the theme.

TooltipPopup API

Import

import * as Tooltip from '@base_ui/react/Tooltip';
const TooltipPopup = Tooltip.Popup;

Props

Props of the native component are also available.

NameTypeDescription
classNamefunc
| string

Class names applied to the element or a function that returns them based on the component's state.

renderelement
| func

A function to customize rendering of the component.


The ref is forwarded to the root element.

Theme default props

You can use TooltipPopup to change the default props of this component with the theme.

TooltipPositioner API

Import

import * as Tooltip from '@base_ui/react/Tooltip';
const TooltipPositioner = Tooltip.Positioner;

Props

Props of the native component are also available.

NameTypeDefaultDescription
alignment'center'
| 'end'
| 'start'
'center'

The alignment of the tooltip popup element to the anchor element along its cross axis.

alignmentOffsetnumber0

The offset of the tooltip popup element along its alignment axis.

anchorHTML element
| object
| func
-

The element to which the tooltip popup element is anchored to.

arrowPaddingnumber5

Determines the padding between the arrow and the tooltip popup edges. Useful when the tooltip popup element has rounded corners via border-radius.

classNamefunc
| string
-

Class names applied to the element or a function that returns them based on the component's state.

collisionBoundaryHTML element
| Array<HTML element>
| string
| { height?: number, width?: number, x?: number, y?: number }
'clippingAncestors'

The boundary that the tooltip popup element should be constrained to.

collisionPaddingnumber
| { bottom?: number, left?: number, right?: number, top?: number }
5

The padding between the tooltip popup element and the edges of the collision boundary to add whitespace between them to prevent them from touching.

containerHTML element
| func
-

The container element to which the tooltip positioner is appended to.

hideWhenDetachedboolfalse

Whether the tooltip popup element is hidden if it appears detached from its anchor element due to the anchor element being clipped (or hidden) from view.

keepMountedboolfalse

Whether the tooltip popup remains mounted in the DOM while closed.

positionStrategy'absolute'
| 'fixed'
'absolute'

The CSS position strategy for positioning the tooltip popup element.

renderelement
| func
-

A function to customize rendering of the component.

side'bottom'
| 'left'
| 'right'
| 'top'
'top'

The side of the anchor element that the tooltip popup element should be placed at.

sideOffsetnumber0

The gap between the anchor element and the tooltip popup element.

stickyboolfalse

Whether to allow the tooltip to remain stuck in view while the anchor element is scrolled out of view.


The ref is forwarded to the root element.

Theme default props

You can use TooltipPositioner to change the default props of this component with the theme.

TooltipProvider API

Import

import * as Tooltip from '@base_ui/react/Tooltip';
const TooltipProvider = Tooltip.Provider;

Props

Props of the native component are also available.

NameTypeDefaultDescription
closeDelaynumber-

The delay in milliseconds until tooltips within the group are closed.

delaynumber-

The delay in milliseconds until tooltips within the group are open.

timeoutnumber400

The timeout in milliseconds until the grouping logic is no longer active after the last tooltip in the group has closed.


The component cannot hold a ref.

TooltipRoot API

Import

import * as Tooltip from '@base_ui/react/Tooltip';
const TooltipRoot = Tooltip.Root;

Props

Props of the native component are also available.

NameTypeDefaultDescription
animatedbooltrue

Whether the tooltip can animate, adding animation-related attributes and allowing for exit animations to play. Useful to disable in tests to remove async behavior.

closeDelaynumber0

The delay in milliseconds until the tooltip popup is closed.

defaultOpenbool-

Specifies whether the tooltip is open initially when uncontrolled.

delaynumber600

The delay in milliseconds until the tooltip popup is opened.

delayType'hover'
| 'rest'
'rest'

The delay type to use. rest means the delay represents how long the user's cursor must rest on the trigger before the tooltip popup is opened. hover means the delay represents how long to wait as soon as the user's cursor has entered the trigger.

followCursorAxis'both'
| 'none'
| 'x'
| 'y'
'none'

Determines which axis the tooltip should follow the cursor on.

hoverablebooltrue

Whether the user can move their cursor from the trigger to the tooltip popup without it closing.

onOpenChangefunc-

Callback fired when the tooltip popup is requested to be opened or closed. Use when controlled.

openbool-

If true, the tooltip popup is open. Use when controlled.


The component cannot hold a ref.

TooltipTrigger API

Import

import * as Tooltip from '@base_ui/react/Tooltip';
const TooltipTrigger = Tooltip.Trigger;

Props

Props of the native component are also available.

NameTypeDescription
classNamefunc
| string

Class names applied to the element or a function that returns them based on the component's state.

renderelement
| func

A function to customize rendering of the component.


The ref is forwarded to the root element.

Theme default props

You can use TooltipTrigger to change the default props of this component with the theme.