overlay
A short text hint shown on hover and keyboard focus. Includes its own provider.
npx blankui add tooltipNo TooltipProvider is needed. The trigger must be focusable, so use asChild with a Button.
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
import { Copy } from "lucide-react"
;<Tooltip>
<TooltipTrigger asChild>
<Button size="icon" variant="ghost" aria-label="Copy">
<Copy />
</Button>
</TooltipTrigger>
<TooltipContent>Copy to clipboard</TooltipContent>
</Tooltip>
| Avoid | Instead |
|---|---|
| <TooltipProvider> around the app | Nothing. Each Tooltip has its own provider. |
| title="..." attributes for hints | <Tooltip> |
| A Tooltip as the only label of an icon button | Give the Button an aria-label as well |
Install with the shadcn CLI: npx shadcn add https://blank.vageshwar.dev/r/tooltip.json