Tooltip
A little speech bubble that pops out of whatever it describes, with a bounce, two tiny puffs and a glint.
Installation
❯ npx shadcn@latest add https://yan.moe/r/tooltip.jsonUsage
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"<Tooltip>
<TooltipTrigger>Hover me</TooltipTrigger>
<TooltipContent>ぽんっ!</TooltipContent>
</Tooltip>Each Tooltip brings its own provider. To share one delay across many tooltips,
wrap them in TooltipProvider yourself.
Accessibility
- Built on Radix Tooltip: it opens on hover and on keyboard focus, and closes with Escape.
- A tooltip is a hint, not a label. Icon-only buttons still need
aria-label. - With
prefers-reduced-motion: reduce, the bubble appears without the bounce or the puffs.
API
| Prop | Type | Default |
|---|---|---|
intensitySet on TooltipContent. kawaii: bounce, puffs and a glint. subtle: fade in. off: just appear. | "kawaii" | "subtle" | "off" | "kawaii" |
sideSet on TooltipContent. Preferred side. | "top" | "right" | "bottom" | "left" | "top" |
sideOffsetSet on TooltipContent. Gap between trigger and bubble, in px. | number | 8 |
delayDurationSet on Tooltip or TooltipProvider. Hover delay in ms. | number | 150 |