Tooltip
A short hint on hover or keyboard focus, in the village's inverse colours. It names, it never holds actions: for those, use Popover.
Installation
Or with the shadcn CLI, from the registry:
Usage
One provider
Put one TooltipProvider near the root of the app: once a tooltip is open, the next one opens without the delay
(delay, 300ms here).
Variants
default is inverted, in the village's ink. outline is a popover surface with a border, for a tooltip over dark
content or one that should stay quiet.
Villages
It is drawn in --tooltip and --tooltip-foreground, the inverse of the page, with an arrow; it opens in the nearest VillageScope.
Accessibility
- It shows on hover and on keyboard focus, and closes on Esc.
- Base UI's tooltip is not linked to its trigger with
aria-describedby: the trigger needs its own accessible name, as with thearia-labelabove. Never put information only in a tooltip.
API reference
The parts of Base UI's Tooltip, styled:
| Part | Notes |
|---|---|
TooltipProvider | delay (default 300), closeDelay |
Tooltip | open, defaultOpen, onOpenChange, disabled |
TooltipTrigger | render to use a Button |
TooltipContent | portal, popup and arrow; side (default "top"), sideOffset, align, variant ("default" | "outline"); tooltipVariants({ variant }) returns its classes |