Gradient Background

A background component featuring a subtle yet engaging animated gradient effect, smoothly transitioning colors to enhance visual depth.

import { GradientBackground } from "@/components/animate-ui/backgrounds/gradient"

export default function GradientBackgroundDemo() {
  return <GradientBackground className="absolute inset-0" />
}

Installation

npx shadcn@latest add @animate-ui/backgrounds-gradient
pnpm dlx shadcn@latest add @animate-ui/backgrounds-gradient
yarn dlx shadcn@latest add @animate-ui/backgrounds-gradient
bun x shadcn@latest add @animate-ui/backgrounds-gradient

Usage

import { GradientBackground } from '@/components/animate-ui/backgrounds/gradient';

export function Hero() {
  return (
    <section className="relative h-[480px] overflow-hidden">
      <GradientBackground className="absolute inset-0" />
    </section>
  );
}

Animation

  • A large gradient slides back and forth behind the container (background-position), one round trip every 15s.
  • It pauses off screen and while the tab is hidden.
  • Under reduced motion, it holds its first frame.

API Reference

GradientBackground

PropTypeDefault
transition?
Transition{ duration: 15, ease: 'easeInOut', repeat: Infinity }
...props?
HTMLMotionProps<'div'>-

Built by Skyleen. The source code is available on GitHub.

Last updated: 10/25/2026