Tooltip
A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
Examples
Default
Add to library testing again
<c-tooltip>
<c-tooltip-trigger>
<c-button variant="outline">Hover me</c-button>
</c-tooltip-trigger>
<c-tooltip-content>
<p>Add to library testing again</p>
</c-tooltip-content>
</c-tooltip>
Custom Styling
<c-tooltip>
<c-tooltip-trigger>
<c-button>Styled Tooltip</c-button>
</c-tooltip-trigger>
<c-tooltip-content
tooltip-content-classes="bg-primary text-primary-foreground"
side="bottom"
arrow-classes="bg-primary"
>
<p class="flex items-center gap-2">
<c-lucide-icon icon="info" size="14"></c-lucide-icon>
Custom styled tooltip
</p>
</c-tooltip-content>
</c-tooltip>
API Reference
Tooltip
Root component that manages tooltip state and timing.
TooltipTrigger
The element that triggers the tooltip to appear.
TooltipContent
The content displayed when the tooltip is open.
Events
openchange
Fired when the tooltip open state changes.
interface OpenChangeEvent {
detail: {
open: boolean;
tooltipId: string;
};
}
Usage Notes
- The tooltip automatically handles hover and focus interactions
- Use
delay-durationto control how long users must hover before the tooltip appears - Use
skip-delay-durationto provide instant tooltips when moving between triggers quickly - The tooltip will stay open when hovering over the content unless
disable-hoverable-contentis true - Positioning is handled automatically using Floating UI with collision detection