Tooltip
A popup that displays information related to an element when it receives keyboard focus or the mouse hovers over it.
Usage
Tooltip Props
The Tooltip component accepts various props to customize its behavior and appearance. You can use it either as a standalone component or nested within a TooltipProvider for enhanced functionality.
Prop | Type | Default |
---|---|---|
message | ReactNode | - |
children | ReactNode | - |
side | "top" | "right" | "bottom" | "left" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top" |
followCursor | boolean | false |
disabled | boolean | false |
open | boolean | - |
defaultOpen | boolean | - |
onOpenChange | ((open: boolean) => void) | false |
delayDuration | number | 200 |
disableHoverableContent | boolean | - |
id | string | - |
className | string | - |
Tooltip.Provider Props
The TooltipProvider component serves as a context wrapper that provides global configuration and functionality to all tooltip instances within your application.
Prop | Type | Default |
---|---|---|
delayDuration | number | 200 |
skipDelayDuration | number | 200 |
disableHoverableContent | boolean | - |
Examples
Side
The Tooltip component can be positioned in different directions using the side
prop:
Custom Content
Tooltips can contain custom content using ReactNode:
With Provider
The TooltipProvider component can be used to provide a global configuration for all tooltips in your application.
Follow Cursor
When followCursor
is true, the tooltip will follow the cursor and will be positioned relative to the cursor.
Accessibility
The Tooltip component follows WAI-ARIA guidelines for tooltips:
- Uses
role="tooltip"
for proper semantic meaning - Automatically manages focus and hover interactions
- Supports keyboard navigation
- Provides appropriate ARIA attributes for accessibility
- Manages enter/exit animations for smooth user experience