Installation
pnpm dlx shadcn@latest add https://dithercn.dev/r/aurora.jsonUsage
import { Aurora } from "@/components/dithercn/aurora";
export function Hero() {
return (
<section className="relative isolate min-h-[480px]">
<Aurora className="absolute inset-0 -z-10" />
<h1>Your headline</h1>
</section>
);
}Each curtain has a bright lower edge that folds slowly, with rays that fade as they rise. Further curtains hang higher and dimmer. height sets where the lowest edge hangs, so you can keep the area under it clear for text.
The props group into three jobs:
- Shape:
curtains,height,spread,sway,turbulence,rays,length. - Light and colour:
colorfor the edges,tipColorfor the tops of the rays,background,glow,intensity,shimmer. Passpaletteto set every tone yourself. - Placement and motion:
tilt,scale,drift,direction,mask, plus the engine'sspeed,cellandmatrix.
Examples
Above a headline
Raising height lifts the curtains off the lower third, where the headline sits on clean paper. A tipColor of "blue" shifts the tops of the rays to a second, cooler hue, and mask="edges" fades the sides.
Northern lights
Your own colours turn it into the real thing: green edges, violet tips and a night-sky background. Four curtains, longer rays, a slight tilt and a little drift give it depth.
Hanging over a call to action
direction="down" flips the curtains so the rays fall from the top and the button sits on clear paper below. Few broad rays and 4px cells give it a coarser, poster-like grain.
Still, in a banner
With animate={false} it draws one frame. stillTime picks which moment, so you can choose a shape you like.
Props
| Prop | Type | Default |
|---|---|---|
| color The bright lower edge of each curtain. | Type: DitherColor | Default "--dither-ink" |
| tipColor The faint tops of the rays. Set a second colour for a two-tone sky. | Type: DitherColor | Default color |
| background The sky behind. | Type: DitherColor | Default "--dither-paper" |
| curtains How many curtains, from 1 to 6. Each one hangs higher and dimmer. | Type: number | Default 3 |
| height Where the lowest bright edge hangs, from 0 (bottom) to 1 (top). | Type: number | Default 0.42 |
| spread Vertical gap between curtains, from 0 to 0.3. | Type: number | Default 0.11 |
| sway How far the edges fold. 0 is straight, 3 is deep folds. | Type: number | Default 1 |
| turbulence Fine ripples along each edge, from 0 to 2. | Type: number | Default 0.6 |
| rays How many rays fit across. 2 gives broad bands, 20 fine needles. | Type: number | Default 8 |
| length How far the rays reach up, from 0 to 1. | Type: number | Default 0.45 |
| glow Brightness of the line along each edge, from 0 to 2. | Type: number | Default 0.9 |
| intensity Brightness of the curtains, from 0 to 1. | Type: number | Default 0.95 |
| shimmer A slow brightness ripple, from 0 to 1. | Type: number | Default 0.2 |
| scale Horizontal zoom. Higher values fit more folds across. | Type: number | Default 1 |
| tilt Tilt of the curtains in degrees, from -45 to 45. | Type: number | Default 0 |
| drift Sideways travel, from -2 (left) to 2 (right). | Type: number | Default 0 |
| direction "down" flips it so the rays hang from a bright top edge. | Type: "up" | "down" | Default "up" |
| mask Fades it to paper where your text sits. | Type: "none" | "top" | "bottom" | "edges" | Default "none" |
| palette Takes over the colours: paper first, brightest last. Palette names, CSS variable names or any CSS colour. | Type: [DitherColor, DitherColor, ...DitherColor[]] | Default Built from the colour props |
| matrix The threshold pattern. See Dither engine. | Type: "bayer2" | "bayer4" | "bayer8" | "blue-noise" | Default "bayer8" |
| levels Tones the field snaps to before dithering. Low values give hard steps. | Type: number | Default All the matrix can draw |
| cell Size of one dither cell in CSS pixels. | Type: number | Default --dither-cell |
| speed How fast it moves. | Type: number | Default 1 |
| animate false draws one still frame. | Type: boolean | Default true |
| stillTime The moment drawn when motion is off or reduced, in seconds. | Type: number | Default 0 |
| className Size and position. The background fills this box. | Type: string | Default – |
Notes
- It is decorative and hidden from assistive technology. Put real text on top of it, not inside it.
- With reduced motion turned on, it draws one still frame and stops.
- It pauses when scrolled out of view or when the tab is hidden, and releases its WebGL context when far offscreen. Without WebGL it shows a CSS approximation in the same colours.
- It costs one small draw per frame at 30 fps, at one pixel per dither cell. More
curtainscost a little more per pixel. See Performance.