A simple opacity entrance tied to view or scroll.
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/fade.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/fade.json
Turn on the motion
npx @prequelui/cli@latest animate fadeThe 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 { Fade } from "@/components/prequelui/effects/fade";
export default function Demo() {
return (
<Fade opacity={1} className="text-4xl font-medium">
A quiet entrance.
</Fade>
);
}import { Fade } from "@/components/prequelui/fade";
export function Variant() {
return (
<Fade tempo={1.2}>
…
</Fade>
);
}Animation
The simplest entrance in the catalogue: a single opacity value on the entrance spring. Because it only touches opacity, it can be composed under a blur, a slide or a zoom without competing for the same property.
- Spring: stiffness 200, damping 20.
- Initial and final opacity are both configurable.
- The list variant staggers the children by holdDelay.
- Reduced motion keeps the fade; opacity is not a travel effect.
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.
Fade
| Prop | Type | Default |
|---|---|---|
| initialOpacity | number | 0 |
| opacity | number | 1 |
| delay | number | 0 |
| inView | boolean | false |
| inViewOnce | boolean | true |
| inViewMargin | string | "0px" |
| transition | Transition | component spring or tween |
| asChild | boolean | false |
| className | string | — |
Fades
| Prop | Type | Default |
|---|---|---|
| holdDelay | number | 0 |
| children | ReactElement[] | — |