Gradient Button

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

Installation

pnpm dlx shadcn@latest add https://gradients.sh/r/gradient-button.json

Usage

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

PropTypeDefault
children

The label, optionally with an icon.

ReactNode—
kind

Which gradient fills the component: one of the six free kinds, or any kind registered with the engine.

GradientKind"mesh"
size

Height and padding.

"sm" | "md" | "lg""md"
type

Plus every other native button attribute, such as disabled and onClick.

"button" | "submit" | "reset""button"
colors

Two to six colours: hex, oklch(), names or var(--token).

[string, string, ...string[]]["#5b3df0", "#9b2fd9", "#c2255c", "#2f5fd9"]
background

Base colour under the gradient.

string"#3b1fd1"
speed

0 to 2. How fast the gradient moves. 0 holds it still.

number0.9
loopSeconds

4 to 30. The animation repeats exactly every loopSeconds.

number14
scale

0.25 to 4. Noise frequency: higher means smaller shapes.

number1.3
warp

0 to 1. Domain-warp strength.

number0.4
grain

0 to 1. Film grain.

number0
blur

0 to 1. Softness.

number0.4
seed

Integer seed for the noise field.

number42
dither

Ordered 4×4 Bayer dither.

{ enabled?: boolean; cell?: number; levels?: number }{ enabled: false, cell: 3, levels: 8 }
interaction

0 to 1 influence of the pointer and of scroll velocity.

{ pointer?: number; scroll?: number }{ pointer: 0, scroll: 0 }
maxDpr

Device pixel ratio cap for the canvas.

number1.5
reducedMotion

"respect" shows one still frame when the user prefers reduced motion.

"respect" | "ignore""respect"
className

Classes for the outer element. Size it here; the gradient fills it.

string—