Tooltip
Tooltips display a brief, informative message that appears when a user interacts with an element.
Installation
The above command is for individual installation only. You may skip this step if @heroui/react is already installed globally.
Import
For individual installation, please note that you should add
./node_modules/@heroui/theme/dist/components/popover.jsto yourtailwind.config.jsfile instead since tooltip reuses popover styles.
Usage
With Arrow
Colors
Placements
Offset
Controlled
With Delay
You can control the open and close delay of the tooltip with delay and closeDelay props.
Hovering over the second button shows the tooltip immediately. If you wait for a delay before hovering another element, the delay restarts.
Custom Content
Custom Motion
Tooltip offers a motionProps property to customize the enter / exit animation.
Learn more about Framer motion variants here.
Slots
- base: The main tooltip slot, it wraps the tooltip content.
- arrow: The arrow slot, it wraps the tooltip arrow, the placement of the arrow is based on the tooltip placement, e.g.
data-[placement=top]:....
Custom Styles
You can customize the Tooltip component by passing custom Tailwind CSS classes to the component slots.
Data Attributes
Tooltip has the following attributes on the base element:
- data-open: When the tooltip is open. Based on tooltip state.
- data-placement:
The placement of the tooltip. Based on
placementprop. The arrow element is positioned based on this attribute. - data-disabled:
When the tooltip is disabled. Based on
isDisabledprop.
Accessibility
- Keyboard focus management and cross browser normalization.
- Hover management and cross browser normalization.
- Labeling support for screen readers (aria-describedby).
- Exposed as a tooltip to assistive technology via ARIA.
- Matches native tooltip behavior with delay on hover of first tooltip and no delay on subsequent tooltips.
API
Tooltip Props
| Prop | Type | Default |
children* | | |
content | | |
size | | "md" |
color | | "default" |
radius | | "md" |
shadow | | "sm" |
placement | | "top" |
delay | | "0" |
closeDelay | | "500" |
isOpen | | |
defaultOpen | | |
offset | | "7" |
containerPadding | | "12" |
crossOffset | | "0" |
showArrow | | false |
shouldFlip | | true |
triggerScaleOnOpen | | true |
isKeyboardDismissDisabled | | false |
isDismissable | | false |
shouldCloseOnBlur | | true |
motionProps | | |
portalContainer | | "document.body" |
updatePositionDeps | | "[]" |
isDisabled | | false |
disableAnimation | | false |
classNames | |
Tooltip Events
| Prop | Type | Default |
onOpenChange | | |
shouldCloseOnInteractOutside | | |
onClose | |

