A tooltip that blooms from 70% and warms up its next appearance.
Installation
Install the packages
npm install @prequelui/react motion@prequelui/react reuses the primitive library your components already depend on.
Add the component
npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/tooltip.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/tooltip.json
Turn on the motion
npx @prequelui/cli@latest animate tooltipThe CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.
Usage
Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.
import {
Tooltip,
TooltipTrigger,
TooltipContent,
TooltipProvider,
} from "@/components/prequelui/tooltip";
export default function Demo() {
return (
<TooltipProvider delay={180}>
<Tooltip>
<TooltipTrigger>
<button type="button">Hover me</button>
</TooltipTrigger>
<TooltipContent side="top">Saved just now</TooltipContent>
</Tooltip>
</TooltipProvider>
);
}import { Tooltip } from "@/components/prequelui/tooltip";
export function Variant() {
return (
<Tooltip tempo={1.2}>
…
</Tooltip>
);
}Animation
The tooltip blooms from 70% of its size with a six-pixel blur and comes to rest on a soft spring. Once a tooltip has been seen, the next one opens without the delay, so moving across a toolbar feels continuous.
- Entry spring: 400 / 31 from scale 0.7, 6 px blur and a 6 px offset.
- Exit: 130 ms on the leave curve, shorter than the entrance.
- Warm-up window: 300 ms after a close, the delay is skipped.
- Escape closes the current tooltip without moving focus.
- Reduced motion removes scale, offset and blur.
API Reference
Every part takes exactly the props of the Tooltip primitive. The animated surface adds only motion props, so the accessibility tree and keyboard behaviour stay the same.
TooltipProvider
| Prop | Type | Default |
|---|---|---|
| delay | number | 180 |
| closeDelay | number | 80 |
| warmUp | number | 300 |
Tooltip
| Prop | Type | Default |
|---|---|---|
| open | boolean | — |
| defaultOpen | boolean | false |
| onOpenChange | (open: boolean) => void | — |
| side | "top" | "bottom" | "left" | "right" | "top" |
| sideOffset | number | 8 |
| delay | number | provider |
| closeDelay | number | provider |
TooltipContent
| Prop | Type | Default |
|---|---|---|
| side | "top" | "bottom" | "left" | "right" | inherited |
| sideOffset | number | inherited |
| transition | Transition | component spring or tween |
| exitTransition | Transition | 130 ms, leave curve |
| className | string | — |