Loading component…
Loading component…
A fine line grid that drifts slowly behind your content and fades out towards the edges
To reuse this local React demo, copy all files from the Code tab into the same folder, then import GridBackground from ./grid-background.
import { GridBackground } from "@/components/ui/grid-background";
export function Hero() {
return (
<GridBackground size={48} direction="diagonal">
<section style={{ display: "grid", placeItems: "center", minHeight: 480 }}>
<h1>Build on a steady grid</h1>
</section>
</GridBackground>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | Content rendered above the grid | |
| size | number | 48 | Cell size in px |
| color | string | rgba(0,0,0,.07) | Line color; dark mode defaults to rgba(255,255,255,.07) |
| speed | number | 3 | Seconds per cell; 0 keeps the grid still |
| direction | "up" \| "down" \| "left" \| "right" \| "diagonal" | "diagonal" | Drift direction; diagonal runs from top right to bottom left |
| reveal | boolean | true | Uncover the grid with a circle growing from the center when it first comes into view |
| fade | number | 70 | Radius of the edge fade, in % of the distance to the corners |
| className | string | Extra class on the container – give it a height or let the content size it |
Fills its container at any size; the fade follows the container's shape
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"
@import "tailwindcss"; in your main CSS file.