Tooltip
A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
Installation
›pnpm dlx shadcn@latest add @evolphin/tooltip
Usage
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";<TooltipProvider>
<Tooltip>
<TooltipTrigger>Hover</TooltipTrigger>
<TooltipContent>
<p>Add to library</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>Type Definitions
interface TooltipContentProps {
/** The distance in pixels from the trigger */
sideOffset?: number;}Examples
Default
API Reference
TooltipProvider
| Prop | Type | Default | Description |
|---|---|---|---|
delayDuration | number | 700 | The duration from when the mouse enters the trigger until the tooltip opens. |
skipDelayDuration | number | 300 | How much time a user has to enter another trigger without incurring the delay again. |
disableHoverableContent | boolean | false | Prevents TooltipContent from remaining open when hovered. |
Tooltip
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | - | The controlled open state of the tooltip. |
defaultOpen | boolean | - | The default open state when uncontrolled. |
onOpenChange | (open: boolean) => void | - | Event handler called when the open state changes. |
delayDuration | number | 700 | Override the provider's delay duration. |
TooltipTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Change the component to the HTML tag or custom component of the only child. |
TooltipContent
| Prop | Type | Default | Description |
|---|---|---|---|
side | `"top" \ | "right" \ | "bottom" \ |
sideOffset | number | 4 | The distance in pixels from the trigger. |
align | `"start" \ | "center" \ | "end"` |
className | string | - | Additional CSS classes |