Background

Gradient

A quiet animated gradient that gives the page depth.

gradient.tsx

Installation

1

Install the packages

npm install @prequelui/react motion

@prequelui/react reuses the primitive library your components already depend on.

2

Add the component

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/gradient.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/gradient.json

3

Turn on the motion

npx @prequelui/cli@latest animate gradient

The 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.

gradient.tsx
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.
400% gradient16 s loopconic sheenfrozen still

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

PropTypeDefault
gradientstringviolet → rose → amber → teal
speednumber1
pausedbooleanfalse
classNamestring—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026