# Tooltip **Category**: react **URL**: https://heroui.com/en/docs/react/components/tooltip **Source**: https://raw.githubusercontent.com/heroui-inc/heroui/refs/heads/v3/apps/docs/content/docs/en/react/components/(overlays)/tooltip.mdx > Displays informative text when users hover over or focus on an element *** ## Usage ```tsx import { Tooltip } from '@heroui/react'; ``` ```tsx import {CircleInfo} from "@gravity-ui/icons"; import {Button, Tooltip} from "@heroui/react"; export function TooltipBasic() { return (

This is a tooltip

More information

); } ``` ## Anatomy ```tsx import { Tooltip, Button } from '@heroui/react'; export default () => ( Helpful information about this element ) ``` ## Examples ### Placement ```tsx import {Button, Tooltip} from "@heroui/react"; export function TooltipPlacement() { return (

Top placement

Left placement

Hover buttons

Right placement

Bottom placement

); } ``` ### With Arrow ```tsx import {Button, Tooltip} from "@heroui/react"; export function TooltipWithArrow() { return (

Tooltip with arrow indicator

Custom offset from trigger

); } ``` ### Custom Triggers ```tsx import {CircleCheckFill, CircleQuestion} from "@gravity-ui/icons"; import {Avatar, Chip, Tooltip} from "@heroui/react"; export function TooltipCustomTrigger() { return (
JD

Jane Doe

jane@example.com

Active

Jane is currently online

Help Information

This is a helpful tooltip with more detailed information about this feature.

); } ``` ### Render Function ```tsx "use client"; import {CircleInfo} from "@gravity-ui/icons"; import {Button, Tooltip} from "@heroui/react"; export function RenderFunction() { return (
}>

This is a tooltip

}>

More information

); } ``` ## Customization ### Tailwind CSS ```tsx import {Button, Tooltip} from "@heroui/react"; export function CustomStyles() { return (

Copied to clipboard

); } ``` ### Global CSS To customize the Tooltip component classes, you can use the `@layer components` directive. [Learn more](https://tailwindcss.com/docs/adding-custom-styles#adding-component-classes). ```css @layer components { .tooltip { @apply rounded-xl shadow-lg; } .tooltip__trigger { @apply cursor-help; } } ``` ## Styling Reference HeroUI follows the [BEM](https://bem.info/en/methodology/) methodology to ensure component variants and states are reusable and easy to customize. ### Global Delay Configuration The default theme sets the opening delay to `1500ms` and the closing delay to `500ms`. Override these CSS variables in your global stylesheet: ```css :root { --tooltip-delay: 1500ms; --tooltip-close-delay: 500ms; } .light, [data-theme="light"] { --tooltip-delay: 1200ms; } .dark, [data-theme="dark"] { --tooltip-close-delay: 300ms; } ``` Values support CSS time units such as `ms` and `s`. The `delay` and `closeDelay` props on an individual Tooltip override these global settings. ### CSS Classes The Tooltip component uses these CSS classes ([View source styles](https://github.com/heroui-inc/heroui/blob/v3/packages/styles/components/tooltip.css)): #### Base Classes [!toc] - `.tooltip` - Base tooltip styles with animations - `.tooltip__trigger` - Trigger element styles ### Interactive States The component supports animation states: - **Entering**: `[data-entering]` - Applied during tooltip appearance - **Exiting**: `[data-exiting]` - Applied during tooltip disappearance - **Placement**: `[data-placement="*"]` - Applied based on tooltip position ## API Reference ### Tooltip | Prop | Type | Default | Description | |------|------|---------|-------------| | `children` | `React.ReactNode` | - | Trigger element and content | | `delay` | `number` | `1500` or CSS variable | Delay in milliseconds before showing tooltip; configured globally with `--tooltip-delay` | | `closeDelay` | `number` | `500` or CSS variable | Delay in milliseconds before hiding tooltip; configured globally with `--tooltip-close-delay` | | `trigger` | `"hover" \| "focus"` | `"hover"` | How the tooltip is triggered | | `isDisabled` | `boolean` | `false` | Whether the tooltip is disabled | | `shouldSkipAnimation` | `boolean` | `false` | Whether to skip the enter and exit animations when moving quickly from one tooltip to another | ### Tooltip.Content | Prop | Type | Default | Description | |------|------|---------|-------------| | `children` | `React.ReactNode` | - | Content to display in the tooltip | | `showArrow` | `boolean` | `false` | Whether to show the arrow indicator | | `offset` | `number` | `3` (7 with arrow) | Distance from the trigger element | | `placement` | `"top" \| "bottom" \| "left" \| "right"` (and variants) | `"top"` | Placement of the tooltip | | `className` | `string` | - | Additional CSS classes | | `render` | `DOMRenderFunction` | - | Overrides the default DOM element with a custom render function.| ### Tooltip.Trigger | Prop | Type | Default | Description | |------|------|---------|-------------| | `children` | `React.ReactNode` | - | Element that triggers the tooltip | | `className` | `string` | - | Additional CSS classes | ### Tooltip.Arrow | Prop | Type | Default | Description | |------|------|---------|-------------| | `children` | `React.ReactNode` | - | Custom arrow element | | `className` | `string` | - | Additional CSS classes | | `render` | `DOMRenderFunction` | - | Overrides the default DOM element with a custom render function.| ## Related Components ## Related Components - **Button**: Allows a user to perform an action - **Popover**: Displays content in context with a trigger