Tooltip
Use Tooltip for brief, optional help on hover or keyboard focus, especially for a compact icon action.
Preview
Icon and keyboard-focus hints
Hover or focus a named watchlist icon and a text button to compare hints above and below their triggers.
Installation
New to this Registry? Complete the base setup before continuing.
npx shadcn@latest add @neumorphism-ui/tooltipInstall the shared base once, then add components and their dependencies with the CLI.
Icon and keyboard-focus hints
npx shadcn@latest add @neumorphism-ui/button @neumorphism-ui/tooltipUsage
Place TooltipTrigger and TooltipContent within Tooltip and share a TooltipProvider where useful. Keep the trigger independently named; essential instructions belong in visible text.
"use client";
import { Button } from "@/components/ui/button";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
export default function Example() {
return (
<TooltipProvider>
<Tooltip>
<TooltipTrigger render={<Button />}>Formatting</TooltipTrigger>
<TooltipContent>Choose how text appears.</TooltipContent>
</Tooltip>
</TooltipProvider>
);
}API Reference
Built on Base UI Tooltip by composing Provider, Root, Trigger, Portal, Positioner, and Popup. The default provider delay is 250ms, and the popup automatically avoids collisions around the trigger.
| Component | Prop | Type | Default | Description |
|---|---|---|---|---|
TooltipProvider | delay | number | 250 | The delay in milliseconds before opening the tooltip after pointer hover. |
Tooltip | open / defaultOpen | boolean | false | The controlled open state or initial uncontrolled open state. |
Tooltip | onOpenChange | (open: boolean) => void | — | Called when the open state changes. |
TooltipTrigger | render | ReactElement | (props, state) => ReactElement | — | Composes tooltip trigger behavior onto a button or link. |
TooltipContent | side / align | "top" | "right" | "bottom" | "left" / "start" | "center" | "end" | "top" / "center" | Positions the popup relative to the trigger. |
TooltipContent | sideOffset | number | 8 | The distance between the trigger and popup. |
Accessibility
- 01
Tooltip does not replace the accessible name of its trigger, so icon buttons still need an aria-label.
- 02
Keep the content brief and supplementary; do not place essential instructions or error messages only in Tooltip.
- 03
Base UI opens Tooltip on keyboard focus as well as hover and closes it with Escape.