A Tooltip can be used to display some content when user hovers on another element.
placement
delay
closeDelay
offset
isDisabled
1<Tooltip>
2 <Tooltip.Trigger>
3 Hover me to open the tooltip
4 </Tooltip.Trigger>
5 <Tooltip.Content>
6 Hello, I'm the content!
7 </Tooltip.Content>
8</Tooltip>1<Tooltip>
2 <Tooltip.Trigger></Tooltip.Trigger>
3 <Tooltip.Content></Tooltip.Content>
4</Tooltip>npm install @rootui/tooltip1import { Tooltip } from "@rootui/tooltip";
2
3export default function Page() {
4 return (
5 <Tooltip>
6 <Tooltip.Trigger>I'm the trigger</Tooltip.Trigger>
7 <Tooltip.Content>I'm the content</Tooltip.Content>
8 </Tooltip>
9 )
10}See the React Aria documentation for more information.
Prop | Type | Default |
|---|---|---|
| | |
Whether the tooltip should be disabled, independent from the trigger. | ||
| | |
The delay time for the tooltip to show up. | ||
| | |
The delay time for the tooltip to close. | ||
| | |
By default, opens for both focus and hover. Can be made to open only for focus. | ||
| | |
Whether the tooltip should close when the trigger is pressed. | ||
| | |
Whether the tooltip is open by default (controlled). | ||
| | |
Whether the tooltip is open by default (uncontrolled). | ||
| | |
Handler that is called when the tooltip's open state changes. | ||
| | |
Prop | Type | Default |
|---|---|---|
| | |
Prop | Type | Default |
|---|---|---|
| | |
The placement of the element with respect to its anchor element. | ||
| | |
| | |
| | |
| | |
Whether the tooltip content (overlay) should update its position automatically. | ||
| | |
The maxHeight specified for the overlay element. By default, it will take all space up to the current viewport height. | ||
| | |
Whether the overlay is open by default (controlled). | ||
| | |
Whether the overlay is open by default (uncontrolled). | ||
| | |
| | |
Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely. | ||
| | |
The additional offset applied along the main axis between the element and its anchor element. | ||
| | |
The additional offset applied along the cross axis between the element and its anchor element. | ||
Attribute | Description |
|---|---|
| The placement of the tooltip relative to the trigger. |
| Whether the tooltip is currently entering. Use this to apply animations. |
| Whether the tooltip is currently exiting. Use this to apply animations. |
CSS variable | Description |
|---|---|
| The position of the trigger relative to the tooltip. Use with transform-origin when applying scale transitions. |