Gradient Text

Real, selectable text filled with a live gradient.

Build something alive

Installation

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

Usage

import { GradientText } from "@/components/gradient-text";

<h1 className="text-5xl font-semibold">
  Build something <GradientText>alive</GradientText>
</h1>;

The text stays real and selectable, and takes its font, size and weight from its parent.

Props

PropTypeDefault
children

The text. Inline content such as <em> works too.

ReactNode—
kind

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

GradientKind"mesh"
colors

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

[string, string, ...string[]]["#ecdcf2", "#8796ee", "#2e45b7", "#0e1645"]
background

Base colour under the gradient.

string"#8796ee"
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.4
warp

0 to 1. Domain-warp strength.

number0.4
grain

0 to 1. Film grain.

number0
blur

0 to 1. Softness.

number0.2
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—