Shader Gradient
A grainy, flowing WebGL gradient that follows the theme and swirls around the pointer.
Preview
Installation
pnpm dlx shadcn@latest add @23rd/shader-gradientOr from the public GitHub registry:
pnpm dlx shadcn@latest add radiumcoders/23rd.dev/shader-gradientUsage
Pin it behind a relatively positioned section, with content in relative z-10.
"use client"
import { ShaderGradient } from "@/components/ui/shader-gradient"
export function Hero() {
return (
<section className="relative isolate min-h-svh overflow-hidden bg-background">
<ShaderGradient />
<div className="relative z-10 mx-auto flex min-h-svh max-w-xl flex-col items-center justify-center px-6 text-center">
<p className="text-xs font-medium tracking-[0.18em] text-muted-foreground uppercase">
New
</p>
<h1 className="mt-3 text-4xl font-medium tracking-tight">
Ship the page, not the backdrop
</h1>
<p className="mt-3 text-muted-foreground">
Headline, proof, and a primary action sit on the wash. The shader
stays quiet.
</p>
</div>
</section>
)
}Lock the theme:
<ShaderGradient theme="light" />
<ShaderGradient theme="dark" />Props
| Prop | Type | Default |
|---|---|---|
colors | string[] | theme palette, up to 4 |
speed | number | 0.14 |
blur | number | 0.7, 0–1 |
intensity | number | 0.95, 0–1 |
grain | number | 0.35, 0–1, 0 for none |
interactive | boolean | true |
theme | "light" | "dark" | "auto" | auto |
className | string | React only |
class | string | Svelte only |
