Tooltip
A popup that appears when an element is hovered or focused, showing a hint for sighted users.
Made by imskyleenPowered by
Installation
Loading component...
Positioning
Loading component...
When to use
Tooltips provide contextual hints for UI elements. Use this decision tree:
Usage
<TooltipProvider>
<Tooltip>
<TooltipTrigger>Hover me</TooltipTrigger>
<TooltipContent>Tooltip content</TooltipContent>
</Tooltip>
</TooltipProvider>Props
Animate UI Props
TooltipContent
Prop
Type
Keyboard interactions
| Key | Action |
|---|---|
Tab to TooltipTrigger | Opens the tooltip (keyboard-focus trigger). |
Shift+Tab off the trigger | Closes the tooltip. |
Escape | Closes the tooltip without moving focus. |
| Mouse hover / blur | Opens after delayDuration, closes immediately on leave. |
Accessibility
- Tooltips are supplementary — never put critical information inside that isn't available elsewhere. Many users (touch, screen-reader, keyboard-only) cannot reliably trigger tooltips.
- The trigger must be focusable (
<button>,<a href>, or another interactive element viaasChild). Wrapping a disabled button requires a focusable outer wrapper (e.g. a<span tabIndex={0}>or a non-disabled styled div). - Content is wired up via
aria-describedbyon the trigger so screen readers read the tooltip as supplementary. - Wrap multiple tooltips in a single
TooltipProvider— Base UI shares adelay/timeoutpool so rapid-hover tooltips don't re-fire the delay.
Controlled vs uncontrolled
Uncontrolled — typical case:
<Tooltip>
<TooltipTrigger asChild><Button>Save</Button></TooltipTrigger>
<TooltipContent>Save (⌘S)</TooltipContent>
</Tooltip>Controlled — force the tooltip open (e.g. to highlight a newly-added feature):
const [open, setOpen] = useState(true);
<Tooltip open={open} onOpenChange={setOpen}>
<TooltipTrigger asChild><Button>New</Button></TooltipTrigger>
<TooltipContent>This is new — click to try it</TooltipContent>
</Tooltip>Credits
- We use Base UI for the tooltip component.
- We take our inspiration from Shadcn UI for the tooltip style.
- We use Animate UI from imskyleen for all the animations.
Recent changes
- patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested b…#133
- minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
- minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
- majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
- minorv0.3.0Add theme-provider component to the registry with documentation and tests. Includes playground type improvements (export RegistryItem, remove as-const boilerplate) and docs site dark mode border color fix.#109
Built by malinskibeniamin. The source code is available on GitHub.