# Installation

Add a moving gradient to a React app in three steps.

Source: https://gradients.sh/docs/getting-started/install

gradients.sh installs through the [shadcn CLI](https://ui.shadcn.com/docs/cli), so it works in any React project shadcn supports: Next.js, Vite, React Router, TanStack Start and others.

For Next.js specifics (Server Components, layouts, static export), see [WebGL gradient backgrounds in Next.js](https://gradients.sh/blog/webgl-gradient-background-nextjs).

## 1. Set up shadcn

Skip this if your project already has a `components.json`.

```bash
npx shadcn@latest init
```

## 2. Add a component

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

This adds `components/mesh-gradient.tsx`, the shared `components/gradient-surface.tsx` and the engine in `lib/gradient-engine/`. The next component you add reuses the surface and the engine.

## 3. Use it

```tsx
import { MeshGradient } from "@/components/mesh-gradient";

export function Hero() {
  return (
    <MeshGradient className="h-[480px]">
      <h1 className="p-12 text-5xl font-semibold text-white">Ship faster</h1>
    </MeshGradient>
  );
}
```

Start your dev server. The heading sits on a slowly moving gradient. For a full landing page hero with theme colours, see [Animated gradient background for shadcn/ui](https://gradients.sh/blog/animated-gradient-background-shadcn).

## Install by name

Add the registry to `components.json` once:

```json
{
  "registries": {
    "@gradients": "https://gradients.sh/r/{name}.json"
  }
}
```

Then install any free component by name:

```bash
npx shadcn@latest add @gradients/aurora
```

## Pro components

Pro components install with the gradients.sh CLI instead. It sets up shadcn if needed and logs your computer in the first time:

```bash
npx gradients.sh add god-rays
```

See [Pro components](https://gradients.sh/docs/pro.md#setup).
