Tooltip

A popup that appears when an element is hovered or focused, showing a hint for sighted users.

API reference

Import the component and place its parts the following way:

Anatomy
import { Tooltip } from '@base-ui-components/react/tooltip';

<Tooltip.Provider>
  <Tooltip.Root>
    <Tooltip.Trigger />
    <Tooltip.Portal>
      <Tooltip.Positioner>
        <Tooltip.Popup>
          <Tooltip.Arrow />
        </Tooltip.Popup>
      </Tooltip.Positioner>
    </Tooltip.Portal>
  </Tooltip.Root>
</Tooltip.Provider>

Provider

Provides a shared delay for multiple tooltips. The grouping logic ensures that once a tooltip becomes visible, the adjacent tooltips will be shown instantly.

PropTypeDefault
closeDelaynumberundefined
delaynumberundefined
timeoutnumber400

Root

Groups all parts of the tooltip. Doesn’t render its own HTML element.

PropTypeDefault
closeDelaynumber0
defaultOpenbooleanfalse
delaynumber600
hoverablebooleantrue
onOpenChange(open, event, reason) => voidundefined
openbooleanundefined
trackCursorAxis'none' | 'x' | 'y' | 'both''none'

Trigger

An element to attach the tooltip to. Renders a <button> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-popup-open

Portal

A portal element that moves the popup to a different part of the DOM. By default, the portal element is appended to <body>.

PropTypeDefault
containerReact.Ref | HTMLElement | nullundefined
keepMountedbooleanfalse

Positioner

Positions the tooltip against the trigger. Renders a <div> element.

PropTypeDefault
align'start' | 'center' | 'end''center'
alignOffsetnumber0
anchor| React.Ref
| Element
| VirtualElement
| (() => Element | VirtualElement | null)
| null
undefined
arrowPaddingnumber5
classNamestring | (state) => stringundefined
collisionBoundary| 'clippingAncestors'
| Element
| Element[]
| Rect
'clipping-ancestors'
collisionPaddingnumber | Rect5
keepMountedbooleanfalse
positionMethod'absolute' | 'fixed''absolute'
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
side| 'bottom'
| 'inline-end'
| 'inline-start'
| 'left'
| 'right'
| 'top'
'top'
sideOffsetnumber0
stickybooleanfalse
Attribute
Description
data-anchor-hidden
data-open
data-side
data-unchecked
CSS Variable
Description
--anchor-height
--anchor-width
--available-height
--available-width
--transform-origin

A container for the tooltip contents. Renders a <div> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-closed
data-ending-style
data-instant
data-open
data-side
data-starting-style

Arrow

Displays an element positioned against the tooltip anchor. Renders a <div> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-anchor-hidden
data-open
data-side
data-uncentered
data-unchecked