Tooltip

A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.

Features

  • Built-in state machine to control display delay.
  • Opens when the trigger is focused or hovered.
  • Closes when the trigger is activated or when pressing escape.

Install the component from your command line.

Import the components and piece the parts together.

Create your styled tooltip component from the primitive parts.

Contains all the parts of a tooltip.

PropTypeDefaultRequired
defaultOpenboolean
openboolean
onOpenChangefunction

The button that toggles the tooltip. By default, the Tooltip.Content will position itself against the trigger.

PropTypeDefaultRequired
asenumbutton

The component that pops out when the tooltip is open.

PropTypeDefaultRequired
asenumdiv
aria-labelstring
portalledbooleantrue
anchorRefref
sideenum"bottom"
sideOffsetnumber0
alignenum"center"
alignOffsetnumber0
avoidCollisionsbooleantrue
collisionToleranceboolean0

An optional arrow element to render alongside the tooltip. This can be used to help visually link the anchor with the Tooltip.Content. Must be rendered inside Tooltip.Content.

PropTypeDefaultRequired
asenumsvg
widthnumber10
heightnumber5
offsetnumber

We expose a CSS custom property --radix-tooltip-content-transform-origin. Use it to animate the content from its computed origin based on side, sideOffset, align, alignOffset and any collisions.

We expose data-side and data-align attributes. Their values will change at runtime to reflect collisions. Use them to create collision and direction-aware animations.

KeyDescription
TabOpens/closes the tooltip without delay.
SpaceIf open, closes the tooltip without delay.
EnterIf open, closes the tooltip without delay.