A quiet animated gradient that gives the page depth.
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/gradient.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/gradient.json
Turn on the motion
npx @prequelui/cli@latest animate gradientThe 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 { GradientBackground } from "@/components/prequelui/backgrounds/gradient";
export default function Demo() {
return (
<div className="relative h-96 overflow-hidden rounded-xl">
<GradientBackground />
</div>
);
}import { Gradient } from "@/components/prequelui/gradient";
export function Variant() {
return (
<Gradient tempo={1.2}>
…
</Gradient>
);
}Animation
An oversized gradient slides behind the content and returns. The loop is slow enough to read as light rather than motion, and a counter-rotating conic sheen keeps the surface from looking flat.
- Background-size is 400%; the position travels 0% → 100% → 0% in 16 s.
- The conic sheen turns once every four loops at a constant rate.
- The gradient is darker by design, so foreground text stays readable.
- Reduced motion freezes the position at an off-centre frame.
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.
GradientBackground
| Prop | Type | Default |
|---|---|---|
| gradient | string | violet → rose → amber → teal |
| speed | number | 1 |
| paused | boolean | false |
| className | string | — |