Gradient Card
A card on a live gradient, with a scrim that keeps white text legible.
Grain
A soft, film-like blend.
import { GradientCard } from "@/components/gradient-card";
export function GradientCardDemo() {
return (
<GradientCard className="h-72 w-full max-w-sm">
<p className="text-lg font-semibold">Grain</p>
<p className="text-sm text-white/75">A soft, film-like blend.</p>
</GradientCard>
);
}
Installation
pnpm dlx shadcn@latest add https://gradients.sh/r/gradient-card.jsonUsage
import { GradientCard } from "@/components/gradient-card";
<GradientCard className="h-72">
<p className="text-lg font-semibold">Grain</p>
</GradientCard>;Content sits at the bottom of the card. The scrim darkens the area behind it so white text stays legible.
Props
| Prop | Type | Default |
|---|---|---|
childrenCard content. It sits at the bottom of the card by default. | ReactNode | — |
kindWhich gradient fills the component: one of the six free kinds, or any kind registered with the engine. | GradientKind | "grain" |
scrimDarken the bottom of the card behind the text. | boolean | true |
colorsTwo to six colours: hex, oklch(), names or var(--token). | [string, string, ...string[]] | ["#ffd8b4", "#e0703b", "#8a2c1d", "#2b1015"] |
backgroundBase colour under the gradient. | string | "#070505" |
speed0 to 2. How fast the gradient moves. 0 holds it still. | number | 0.48 |
loopSeconds4 to 30. The animation repeats exactly every loopSeconds. | number | 16 |
scale0.25 to 4. Noise frequency: higher means smaller shapes. | number | 1 |
warp0 to 1. Domain-warp strength. | number | 0.55 |
grain0 to 1. Film grain. | number | 0.5 |
blur0 to 1. Softness. | number | 0.55 |
seedInteger seed for the noise field. | number | 7 |
ditherOrdered 4×4 Bayer dither. | { enabled?: boolean; cell?: number; levels?: number } | { enabled: false, cell: 3, levels: 8 } |
interaction0 to 1 influence of the pointer and of scroll velocity. | { pointer?: number; scroll?: number } | { pointer: 0.15, scroll: 0 } |
maxDprDevice pixel ratio cap for the canvas. | number | 1.5 |
reducedMotion"respect" shows one still frame when the user prefers reduced motion. | "respect" | "ignore" | "respect" |
classNameClasses for the outer element. Size it here; the gradient fills it. | string | — |