Tooltip
A short label that names a control, shown on hover and keyboard focus.
When to use it
Use Tooltip to name icon buttons and other controls without visible text. Keep it to a few words, and add a shortcut when there is one.
Never put information people need in a tooltip alone: itโs hidden until they find it, and touch screens canโt hover.
TooltipThis page
Names a control.
Icon buttons and unlabeled controls.
How it behaves
Use TooltipProvider once around your app for a shared 400ms hover delay. Nearby tooltips open instantly after the first; keyboard focus is immediate.
Keep an accessible label on each icon button. Tooltips supplement that label and never contain links, buttons, or essential instructions.
Compose TooltipTrigger with render={<Button />}; do not nest buttons. Wrap a disabled button in a span so hover still reaches the trigger.
Base UI handles Escape, pointer dismissal, and collision-aware placement. Touch does not require a tooltip to perform the action.
Content uses semantic foreground/background tokens. Pointer entry uses 125ms opacity and scale; instant states skip animation and reduced motion keeps only opacity. Override className, side, or sideOffset to customize it.
TooltipContent includes Base UI's Arrow, which follows the trigger when placement changes and inherits the popup color. Customize arrowClassName or use showArrow={false} to hide the tail.
Build it
Add it with the shadcn CLI:
1pnpm dlx shadcn@latest add https://jzbui.com/r/tooltip.jsonA complete example. Change the values to fit your product:
12345678910111213import { Bookmark } from "lucide-react"import { Button } from "@/components/ui/button"import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"
// Put TooltipProvider once around your application.<TooltipProvider> <Tooltip> <TooltipTrigger render={<Button variant="outline" size="icon" aria-label="Save item" />}> <Bookmark aria-hidden="true" /> </TooltipTrigger> <TooltipContent>Save item</TooltipContent> </Tooltip></TooltipProvider>The full source is yours to edit once installed: