Fade, blur, slide and zoom composed into one entrance.
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/effect.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/effect.json
Turn on the motion
npx @prequelui/cli@latest animate effectThe 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 { Effect } from "@/components/prequelui/effects/effect";
export default function Demo() {
return (
<Effect
fade
blur
zoom
slide={{ direction: "up", offset: 24 }}
className="rounded-xl border p-6"
>
Four properties, one gesture.
</Effect>
);
}import { Effect } from "@/components/prequelui/effect";
export function Variant() {
return (
<Effect tempo={1.2}>
…
</Effect>
);
}Animation
Effect composes the four entrance primitives on a single element. Each option can be a boolean or a configuration object, and the hidden and visible variants are built once so the properties animate together on the same spring.
- Slide defaults to 100 px upwards; each direction maps to x or y.
- Fade defaults to opacity 0 → 1; zoom to scale 0.5 → 1; blur to 10 px → 0.
- Reduced motion drops slide and zoom and keeps the fade.
- The list variant staggers children by holdDelay.
API Reference
Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.
Effect
| Prop | Type | Default |
|---|---|---|
| fade | boolean | { initialOpacity, opacity } | false |
| blur | boolean | { initialBlur, blur } | false |
| slide | boolean | { direction, offset } | false |
| zoom | boolean | { initialScale, scale } | false |
| delay | number | 0 |
| inView | boolean | false |
| inViewOnce | boolean | true |
| inViewMargin | string | "0px" |
| transition | Transition | component spring or tween |
| className | string | — |
Effects
| Prop | Type | Default |
|---|---|---|
| holdDelay | number | 0 |
| children | ReactElement[] | — |