# Hero Background

A full-bleed hero section on a live gradient that fades into the page.

Source: https://gradients.sh/docs/components/hero-background

## Installation

```bash
npx shadcn@latest add https://gradients.sh/r/hero-background.json
```

Besides the component, the command adds the shared gradient engine and surface, and shadcn's `utils` helper (`cn`, which uses `clsx` and `tailwind-merge`) if your project doesn't have it yet. The engine is source code with no npm dependencies of its own, so there's no Three.js to install.

## Usage

```tsx
import { HeroBackground } from "@/components/hero-background";

<HeroBackground>
  <h1 className="text-5xl font-semibold text-white">Your headline</h1>
</HeroBackground>;
```

The bottom edge fades into `var(--background)`. Set `fade={false}` for a hard edge.

For a step-by-step setup in a shadcn/ui app, with theme colours and tuning, see [Animated gradient background for shadcn/ui](https://gradients.sh/blog/animated-gradient-background-shadcn). For the northern-lights look, pass `kind="aurora"`; [Aurora background effect in React](https://gradients.sh/blog/aurora-background-react) covers it. For readable text over a gradient and hero heights on phones, see [Gradient backgrounds for websites](https://gradients.sh/blog/gradient-background-website).

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | `—` | Hero content, centred on top of the gradient. |
| `kind` | `GradientKind` | `"mesh"` | Which gradient fills the component: one of the six free kinds, or any kind registered with the engine. |
| `fade` | `boolean` | `true` | Fade the bottom edge into var(--background). |
| `colors` | `[string, string, ...string[]]` | `["#ecdcf2", "#8796ee", "#2e45b7", "#0e1645"]` | Two to six colours: hex, oklch(), names or var(--token). |
| `background` | `string` | `"#0a0d24"` | Base colour under the gradient. |
| `speed` | `number` | `0.6` | 0 to 2. How fast the gradient moves. 0 holds it still. |
| `loopSeconds` | `number` | `14` | 4 to 30. The animation repeats exactly every loopSeconds. |
| `scale` | `number` | `1` | 0.25 to 4. Noise frequency: higher means smaller shapes. |
| `warp` | `number` | `0.4` | 0 to 1. Domain-warp strength. |
| `grain` | `number` | `0.1` | 0 to 1. Film grain. |
| `blur` | `number` | `0.45` | 0 to 1. Softness. |
| `seed` | `number` | `42` | Integer seed for the noise field. |
| `dither` | `{ enabled?: boolean; cell?: number; levels?: number }` | `{ enabled: false, cell: 3, levels: 8 }` | Ordered 4×4 Bayer dither. |
| `interaction` | `{ pointer?: number; scroll?: number }` | `{ pointer: 0.3, scroll: 0.25 }` | 0 to 1 influence of the pointer and of scroll velocity. |
| `maxDpr` | `number` | `1.5` | Device pixel ratio cap for the canvas. |
| `reducedMotion` | `"respect" \| "ignore"` | `"respect"` | "respect" shows one still frame when the user prefers reduced motion. |
| `className` | `string` | `—` | Classes for the outer element. Size it here; the gradient fills it. |
