File: tooltip.md | Updated: 11/15/2025
ThemesThemes PrimitivesPrimitives IconsIcons ColorsColors
Documentation Case studies Blog
Search
/
Introduction Getting started Accessibility Releases
Styling Animation Composition Server-side rendering
Accordion
Alert Dialog
Aspect Ratio
Avatar
Checkbox
Collapsible
Context Menu
Dialog
Dropdown Menu
Form
Preview
Hover Card
Label
Menubar
Navigation Menu
One-Time Password Field
Preview
Password Toggle Field
Preview
Popover
Progress
Radio Group
Scroll Area
Select
Separator
Slider
Switch
Tabs
Toast
Toggle
Toggle Group
Toolbar
Tooltip
Accessible Icon Direction Provider Portal Slot Visually Hidden
Components
A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
index.jsxindex.jsxstyles.cssstyles.css
CSS
import * as React from "react";
import { Tooltip } from "radix-ui";
import { PlusIcon } from "@radix-ui/react-icons";
import "./styles.css";
const TooltipDemo = () => {
return (
<Tooltip.Provider>
<Tooltip.Root>
<Tooltip.Trigger asChild>
<button className="IconButton">
<PlusIcon />
</button>
</Tooltip.Trigger>
<Tooltip.Portal>
<Tooltip.Content className="TooltipContent" sideOffset={5}>
Add to library
<Tooltip.Arrow className="TooltipArrow" />
</Tooltip.Content>
</Tooltip.Portal>
</Tooltip.Root>
</Tooltip.Provider>
);
};
export default TooltipDemo;
Provider to control display delay globally.
Opens when the trigger is focused or hovered.
Closes when the trigger is activated or when pressing escape.
Supports custom timings.
Install the component from your command line.
npm install @radix-ui/react-tooltip
Import all parts and piece them together.
import { Tooltip } from "radix-ui";
export default () => (
<Tooltip.Provider>
<Tooltip.Root>
<Tooltip.Trigger />
<Tooltip.Portal>
<Tooltip.Content>
<Tooltip.Arrow />
</Tooltip.Content>
</Tooltip.Portal>
</Tooltip.Root>
</Tooltip.Provider>
);
Wraps your app to provide global functionality to your tooltips.
| Prop | Type | Default |
| --- | --- | --- |
| delayDuration<br><br>Prop description | number | 700 |
| skipDelayDuration<br><br>Prop description | number | 300 |
| disableHoverableContent<br><br>Prop description | boolean | No default value |
Contains all the parts of a tooltip.
| Prop | Type | Default |
| --- | --- | --- |
| defaultOpen<br><br>Prop description | boolean | No default value |
| open<br><br>Prop description | boolean | No default value |
| onOpenChange<br><br>Prop description | function<br><br>See full type | No default value |
| delayDuration<br><br>Prop description | number | 700 |
| disableHoverableContent<br><br>Prop description | boolean | No default value |
The button that toggles the tooltip. By default, the Tooltip.Content will position itself against the trigger.
| Prop | Type | Default |
| --- | --- | --- |
| asChild<br><br>Prop description | boolean | false |
| Data attribute | Values |
| --- | --- |
| [data-state] | "closed" \| "delayed-open" \| "instant-open" |
When used, portals the content part into the body.
| Prop | Type | Default |
| --- | --- | --- |
| forceMount<br><br>Prop description | boolean | No default value |
| container<br><br>Prop description | HTMLElement | document.body |
The component that pops out when the tooltip is open.
| Prop | Type | Default |
| --- | --- | --- |
| asChild<br><br>Prop description | boolean | false |
| aria-label<br><br>Prop description | string | No default value |
| onEscapeKeyDown<br><br>Prop description | function<br><br>See full type | No default value |
| onPointerDownOutside<br><br>Prop description | function<br><br>See full type | No default value |
| forceMount<br><br>Prop description | boolean | No default value |
| side<br><br>Prop description | enum<br><br>See full type | "top" |
| sideOffset<br><br>Prop description | number | 0 |
| align<br><br>Prop description | enum<br><br>See full type | "center" |
| alignOffset<br><br>Prop description | number | 0 |
| avoidCollisions<br><br>Prop description | boolean | true |
| collisionBoundary<br><br>Prop description | Boundary<br><br>See full type | [] |
| collisionPadding<br><br>Prop description | number \| Padding<br><br>See full type | 0 |
| arrowPadding<br><br>Prop description | number | 0 |
| sticky<br><br>Prop description | enum<br><br>See full type | "partial" |
| hideWhenDetached<br><br>Prop description | boolean | false |
| Data attribute | Values |
| --- | --- |
| [data-state] | "closed" \| "delayed-open" \| "instant-open" |
| [data-side] | "left" \| "right" \| "bottom" \| "top" |
| [data-align] | "start" \| "end" \| "center" |
| CSS Variable | Description |
| --- | --- |
| --radix-tooltip-content-transform-origin | The transform-origin computed from the content and arrow positions/offsets |
| --radix-tooltip-content-available-width | The remaining width between the trigger and the boundary edge |
| --radix-tooltip-content-available-height | The remaining height between the trigger and the boundary edge |
| --radix-tooltip-trigger-width | The width of the trigger |
| --radix-tooltip-trigger-height | The height of the trigger |
An optional arrow element to render alongside the tooltip. This can be used to help visually link the trigger with the Tooltip.Content. Must be rendered inside Tooltip.Content.
| Prop | Type | Default |
| --- | --- | --- |
| asChild<br><br>Prop description | boolean | false |
| width<br><br>Prop description | number | 10 |
| height<br><br>Prop description | number | 5 |
Use the Provider to control delayDuration and skipDelayDuration globally.
import { Tooltip } from "radix-ui";
export default () => (
<Tooltip.Provider delayDuration={800} skipDelayDuration={500}>
<Tooltip.Root>
<Tooltip.Trigger>…</Tooltip.Trigger>
<Tooltip.Content>…</Tooltip.Content>
</Tooltip.Root>
<Tooltip.Root>
<Tooltip.Trigger>…</Tooltip.Trigger>
<Tooltip.Content>…</Tooltip.Content>
</Tooltip.Root>
</Tooltip.Provider>
);
Use the delayDuration prop to control the time it takes for the tooltip to open.
import { Tooltip } from "radix-ui";
export default () => (
<Tooltip.Root delayDuration={0}>
<Tooltip.Trigger>…</Tooltip.Trigger>
<Tooltip.Content>…</Tooltip.Content>
</Tooltip.Root>
);
You may want to constrain the width of the content so that it matches the trigger width. You may also want to constrain its height to not exceed the viewport.
We expose several CSS custom properties such as --radix-tooltip-trigger-width and --radix-tooltip-content-available-height to support this. Use them to constrain the content dimensions.
// index.jsx
import { Tooltip } from "radix-ui";
import "./styles.css";
export default () => (
<Tooltip.Root>
<Tooltip.Trigger>…</Tooltip.Trigger>
<Tooltip.Portal>
<Tooltip.Content className="TooltipContent" sideOffset={5}>
…
</Tooltip.Content>
</Tooltip.Portal>
</Tooltip.Root>
);
/* styles.css */
.TooltipContent {
width: var(--radix-tooltip-trigger-width);
max-height: var(--radix-tooltip-content-available-height);
}
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.
// index.jsx
import { Tooltip } from "radix-ui";
import "./styles.css";
export default () => (
<Tooltip.Root>
<Tooltip.Trigger>…</Tooltip.Trigger>
<Tooltip.Content className="TooltipContent">…</Tooltip.Content>
</Tooltip.Root>
);
/* styles.css */
.TooltipContent {
transform-origin: var(--radix-tooltip-content-transform-origin);
animation: scaleIn 0.5s ease-out;
}
@keyframes scaleIn {
from {
opacity: 0;
transform: scale(0);
}
to {
opacity: 1;
transform: scale(1);
}
}
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.
// index.jsx
import { Tooltip } from "radix-ui";
import "./styles.css";
export default () => (
<Tooltip.Root>
<Tooltip.Trigger>…</Tooltip.Trigger>
<Tooltip.Content className="TooltipContent">…</Tooltip.Content>
</Tooltip.Root>
);
/* styles.css */
.TooltipContent {
animation-duration: 0.6s;
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}
.TooltipContent[data-side="top"] {
animation-name: slideUp;
}
.TooltipContent[data-side="bottom"] {
animation-name: slideDown;
}
@keyframes slideDown {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
| 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. | | Escape | If open, closes the tooltip without delay. |
Create your own API by abstracting the primitive parts into your own component.
This example abstracts all of the Tooltip parts and introduces a new content prop.
import { Tooltip } from "./your-tooltip";
export default () => (
<Tooltip content="Tooltip content">
<button>Tooltip trigger</button>
</Tooltip>
);
Use the asChild prop
to convert the trigger part into a slottable area. It will replace the trigger with the child that gets passed to it.
// your-tooltip.jsx
import * as React from "react";
import { Tooltip as TooltipPrimitive } from "radix-ui";
export function Tooltip({
children,
content,
open,
defaultOpen,
onOpenChange,
...props
}) {
return (
<TooltipPrimitive.Root
open={open}
defaultOpen={defaultOpen}
onOpenChange={onOpenChange}
>
<TooltipPrimitive.Trigger asChild>
{children}
</TooltipPrimitive.Trigger>
<TooltipPrimitive.Content side="top" align="center" {...props}>
{content}
<TooltipPrimitive.Arrow width={11} height={5} />
</TooltipPrimitive.Content>
</TooltipPrimitive.Root>
);
}
PreviousToolbar
NextAccessible Icon