Grid background preview

Grid background

A fine line grid that drifts slowly behind your content and fades out towards the edges

  • Group
    Patterns
  • Origin
    Copied · affectUI · source
  • License
    MIT
  • Added
    Oct 18
npx shadcn@latest add @deank/grid-background

The registry stays private. Install from the repo with a GitHub token — see the README.

Usage

import { GridBackground } from "@/registry/components/grid-background/grid-background";

<GridBackground>Label</GridBackground>

Props

NameTypeDefaultDescription
childrenReactNodeContent rendered above the grid
sizenumber48Cell size in px
colorstringrgba(0,0,0,.07)Line color; dark mode defaults to rgba(255,255,255,.07)
speednumber3Seconds per cell; 0 keeps the grid still
direction"up" | "down" | "left" | "right" | "diagonal""diagonal"Drift direction; diagonal runs from top right to bottom left
revealbooleantrueUncover the grid with a circle growing from the center when it first comes into view
fadenumber70Radius of the edge fade, in % of the distance to the corners
classNamestringExtra class on the container – give it a height or let the content size it

When to use

- Hero sections and feature headers that need a quiet, technical backdrop - Empty states or panels that feel too flat on a plain background

When not to use

Behind data tables (competes with lines).

Related

Aurora background · Magnet lines