React Tooltip
A glass React tooltip that appears on hover and keyboard focus; inside a provider, moving between tooltips is instant. Use Tooltip as a glass tooltip to name an icon-only toolbar button on hover or focus, such as Bold or Export, adding the shortcut in the text when there is one.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/tooltip.jsonFormat text
TooltipTooltipProvider
Icon toolbar
import { Button } from "@/components/sheenui/button/button";
import { Tooltip, TooltipProvider } from "@/components/sheenui/tooltip/tooltip";
// Package build (after the first npm release, or a packed tarball): import { Button, Tooltip, TooltipProvider } from "@sheenui/theme";
import { Bold as BoldIcon, Italic as ItalicIcon } from "lucide-react";
// This example also uses button: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json
export function Example() {
return (
<TooltipProvider>
<Tooltip content="Bold">
<Button variant="glass" size="icon" aria-label="Bold"><BoldIcon /></Button>
</Tooltip>
<Tooltip content="Italic" side="bottom">
<Button variant="glass" size="icon" aria-label="Italic"><ItalicIcon /></Button>
</Tooltip>
</TooltipProvider>
);
}Files to copy
4 folders · 4 files · 4 packages
- From
theme/src/ components/tooltip/hooks/use-controllable.tslib/{cn.ts, popup-motion.ts, warn-once.ts}styles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/tooltip.jsonRegistry item: tooltip. The styles need the Tailwind v4 glass UI setup.- The examples also use
components/button/components/spinner/hooks/{use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}motion/{gate.ts, tokens.ts}lib/{form.ts, state-light.tsx}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Sides and delay
side picks the edge it opens on. delay is how long the pointer must rest before it opens; 0 shows it at once. A TooltipProvider makes moving between tooltips instant.
import { Button } from "@/components/sheenui/button/button";
import { Tooltip, TooltipProvider } from "@/components/sheenui/tooltip/tooltip";
// Package build (after the first npm release, or a packed tarball): import { Button, Tooltip, TooltipProvider } from "@sheenui/theme";
// This example also uses button: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json
export function Example() {
return (
<TooltipProvider>
<Tooltip content="Opens above (the default)">
<Button variant="glass">Top</Button>
</Tooltip>
<Tooltip content="Opens to the right" side="right">
<Button variant="glass">Right</Button>
</Tooltip>
<Tooltip content="Opens at once" delay={0}>
<Button variant="glass">No delay</Button>
</Tooltip>
<Tooltip content="Waits a full second" delay={1000} side="bottom">
<Button variant="glass">Slow</Button>
</Tooltip>
</TooltipProvider>
);
}Props
Keyboard
Accessibility
- Tooltip adds no tab stop of its own; the trigger keeps its own. The bubble has role=“tooltip” and, while it is open, the trigger points to it with aria-describedby (added to any description it already has), so the text is announced as its description. It describes, it does not name: an icon-only trigger still needs its own aria-label.
- Keep it to a short label. Anything interactive belongs in a Popover; essential text must not live only in a tooltip.
- The bubble stays open while the pointer moves onto it (so it can be read while magnified) but holds no controls. On touch screens a long press (about half a second) shows it for a couple of seconds, and lifting the finger does not activate the trigger; a plain tap never shows it, so never hide the only label of a control in a tooltip. Under reduced motion it only fades.
When to use Tooltip
- Use Tooltip to label icon-only buttons in an editor toolbar (Bold, Italic, Export) on hover and on keyboard focus, and put the shortcut, such as Ctrl+B, beside the name.
- Use it for short supplementary hints on a form, like why a field wants a particular format, where the hint is useful but nobody is blocked without it.
- Use TooltipProvider once near the app root so moving between neighboring triggers shows the next tip at once, and use delay to tune the 300ms default.
- Skip it when the content is essential, long or interactive. Use Popover for controls, HoverCard for a rich preview, and plain visible text when a label must always be readable.
- Pair it with Button using size icon, Kbd to show shortcuts inside the tip, and Avatar or Badge when a name or status needs a short explanation.
Frequently asked questions
Related pages
67 components pages in all: browse them on All components.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .