UI.MD

Tooltip

A popup that displays additional information when hovering over a trigger element.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/tooltip.json

Usage

import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip"

Examples

Default

Positioning

Control where the tooltip shows with side (top/right/bottom/left) and align (start/center/end) on TooltipContent; both pass straight through to Base UI's positioner. Pick a cell and the code below updates to match your selection.

Tooltip placement

side="top" align="center"

API Reference

PropTypeDefaultDescription
sideTooltipContent"top" | "right" | "bottom" | "left""top"Preferred edge of the trigger to render against.
alignTooltipContent"start" | "center" | "end""center"Alignment against the trigger along the chosen side.
sideOffsetTooltipContentnumber6Distance in pixels between the tooltip and the trigger.
collisionAvoidanceTooltipContentCollisionAvoidance{ fallbackAxisSide: "end" }Object controlling how the tooltip avoids viewport collisions on the side and alignment axes, e.g. { side: 'none', align: 'none' } to always honor side/align.
delayTooltipnumber300Delay in ms before the tooltip opens on hover. Each Tooltip wraps its own TooltipProvider, so an app-level provider's value won't apply.