Getting Started
Templates
Components
Special Effects
Animations
Text Animations
Backgrounds
An ordered dither that follows your theme and your brand colors.
Every branch gets a URL the moment you push.
Static assets served from 300 cities.
Go back to any deploy in one click.
horizonglowaurorawavescloudssunsetplanetmoonriseorbitmeridianeclipseridgelinecontourdunescoronaorbveilimport { Dither } from "@/components/ui/dither"<div className="relative isolate h-[400px] w-full overflow-hidden rounded-xl border">
<Dither pattern="horizon" colors="var(--primary)" className="-z-10" />
</div>| Prop | Type | Default | Description |
|---|---|---|---|
pattern | DitherPattern | "horizon" | One of the 17 built-in patterns, listed in DITHER_PATTERNS. |
src | string | - | Image or video URL to dither. Remote files must allow CORS. |
shader | string | - | GLSL that defines float field(vec2 uv, float t). See Shader. |
colors | string | readonly string[] | "currentColor" | One CSS color, or color stops from dim to bright. |
matrix | 2 | 4 | 8 | 8 | Size of the Bayer matrix. Smaller sizes give coarser bands. |
dotSize | number | 1 | Size of one dot in CSS pixels. |
intensity | number | 0.75 | Brightness of the field. |
speed | number | 1 | Animation speed. 0 holds a still frame. |
fps | number | 30 | Maximum frames per second. |
interactive | boolean | false | Brightens the dots under the pointer. |
className | string | - | Classes applied to the layer. |
float field(vec2 uv, float t) {
return 0.5 + 0.5 * sin((uv.x + uv.y) * 12.0 + t);
}uv runs from 0 to 1 from the bottom-left corner. t is the time in seconds times speed. Return a brightness from 0 to 1. The shader can read uSize, uAspect, uDot, uPointer and uPointerOn, and call noise(vec2) and fbm(vec2).
Dither is a layer. It fills its nearest positioned parent and takes no children. Set only one of pattern, src and shader. Palette patterns use their own colors unless you pass colors.