Tooltip
A floating label that appears on hover or focus to provide additional context about an element.
Import
Usage
Examples
Color
Variant
Size
Radius
Placement
With arrow
Custom delay
Custom offset
Disabled
On icon buttons
On text
User Profile
With custom styling
Props
| Prop | Type | Default | Description |
|---|---|---|---|
content | ReactNode | — | Tooltip content (required) |
children | ReactElement | ReactNode | — | Trigger element (required) |
variant | "solid" | "ghost" | "bordered" | "faded" | "underlined" | "solid"* | Visual style |
color | "none" | "default" | "primary" | "secondary" | "danger" | "warning" | "success" | "secondary"* | Semantic color |
size | "sm" | "md" | "lg" | "md"* | Size scale |
placement | "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end" | "top"* | Tooltip position |
delay | number | { open?: number; close?: number } | 200* | Show/hide delay in ms |
offset | number | 8* | Distance from trigger |
radius | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | "md"* | Corner rounding |
showArrow | boolean | false* | Show arrow indicator |
isDisabled | boolean | false | Disable tooltip |
className | string | — | Extra classes |
* Falls back through Global Configuration if not set — see below.
Global Configuration
Tooltip reads defaults from four places, in this order of precedence:
- Instance prop — set directly on
<Tooltip /> - Component config —
components.tooltipin yourashee.config - Theme default —
defaultVariant/defaultColor/defaultRadiusin yourashee.config - Built-in fallback — component's internal default values
Component config
Built-in fallbacks
Accessibility
- Uses
role="tooltip"for proper semantics - Trigger element receives proper ARIA attributes
- Supports keyboard focus with hover and focus interactions
- Tooltip content is announced by screen readers
- Pointer events disabled on tooltip to allow mouse interaction with trigger
- Dismiss on escape and click outside
Notes
- Children Requirement: The tooltip wraps a single child element that acts as the trigger.
- Delay: Can be a single number (applies to both open and close) or an object with
openandcloseproperties. - Placement: The tooltip automatically flips to prevent overflow using Floating UI.
- Arrow: When
showArrowistrue, an arrow points from the tooltip to the trigger element. - Disabled: The
isDisabledprop prevents the tooltip from appearing, useful for conditional tooltips. - Floating Portal: Tooltips render in a portal to avoid z-index and overflow issues.