# Animated Gradient

> A gradient that drifts slowly across its colours.

So a section feels lit rather than painted. Pure CSS, any number of colours.

- Family: Backgrounds
- Plan: Free. Free to install, no account.
- Requires: React, Tailwind CSS v4 and the motion package
- Page with a live preview: https://galactrex.com/ui/animated-gradient/
- Licence: https://galactrex.com/ui/license/

## Install

```sh
npx @galactrex/ui add animated-gradient
```

It installs to `components/galactrex/animated-gradient.tsx`, with the shared motion helpers beside it. First time in a project: `npx @galactrex/ui init` (setup guide: https://galactrex.com/docs/ui-components-setup/).

## Usage

```tsx
import { AnimatedGradient } from "@/components/galactrex/animated-gradient";

<section className="relative overflow-hidden">
  <AnimatedGradient />
  <h1 className="relative">Welcome</h1>
</section>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `colors` | `string[]` | — | Two or more CSS colours; defaults to quiet theme surfaces. |
| `angle` | `number` | `120` | Direction in degrees. |
| `duration` | `number` | `14` | Seconds for one pass, there and back. |
| `opacity` | `number` | `0.5` | Strength, 0 to 1. |
| `className` | `string` | — | Extra classes for the outer element. |

## Variants

- **Quiet.** Theme surfaces.
- **Brand.** Pass `colors` for a brand wash.

## Accessibility

- Decorative only and aria-hidden; never takes pointer events.
- Check text contrast when passing bright colours.

## Motion

- One CSS background-position animation.
- Still offscreen.
- Reduced motion: a still gradient.
