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.
Prop | Type | Default | Required |
---|---|---|---|
defaultOpen | boolean | ||
open | boolean | ||
onOpenChange | function |
The button that toggles the tooltip. By default, the Tooltip.Content
will position itself against the trigger.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | button |
The component that pops out when the tooltip is open.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div | |
aria-label | string | ||
portalled | boolean | true | |
anchorRef | ref | ||
side | enum | "bottom" | |
sideOffset | number | 0 | |
align | enum | "center" | |
alignOffset | number | 0 | |
avoidCollisions | boolean | true | |
collisionTolerance | boolean | 0 |
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
.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | svg | |
width | number | 10 | |
height | number | 5 | |
offset | number |
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.
Key | Description |
---|---|
Tab | Opens/closes the tooltip without delay. |
Space | If open, closes the tooltip without delay. |
Enter | If open, closes the tooltip without delay. |