# Gradient Button

A button with a live gradient fill and hover, press, focus and disabled states.

Source: https://gradients.sh/docs/components/gradient-button

<ComponentPreview center>
  <GradientButtonDemo />

  <include cwd lang="tsx" meta='title="gradient-button-demo.tsx"'>components/docs/demos/gradient-button.tsx</include>
</ComponentPreview>

## Installation

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

## Usage

```tsx
import { GradientButton } from "@/components/gradient-button";

<GradientButton onClick={start}>Get started</GradientButton>;
```

It takes every native button attribute, such as `disabled`, `onClick` and `type`.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | `—` | The label, optionally with an icon. |
| `kind` | `GradientKind` | `"mesh"` | Which gradient fills the component: one of the six free kinds, or any kind registered with the engine. |
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Height and padding. |
| `type` | `"button" \| "submit" \| "reset"` | `"button"` | Plus every other native button attribute, such as disabled and onClick. |
| `colors` | `[string, string, ...string[]]` | `["#5b3df0", "#9b2fd9", "#c2255c", "#2f5fd9"]` | Two to six colours: hex, oklch(), names or var(--token). |
| `background` | `string` | `"#3b1fd1"` | Base colour under the gradient. |
| `speed` | `number` | `0.9` | 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.3` | 0.25 to 4. Noise frequency: higher means smaller shapes. |
| `warp` | `number` | `0.4` | 0 to 1. Domain-warp strength. |
| `grain` | `number` | `0` | 0 to 1. Film grain. |
| `blur` | `number` | `0.4` | 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, scroll: 0 }` | 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. |
