All components

Grid Background

A decorative grid background with customizable size, color, thickness, and opacity.

Default
Live-tune cell size, line color, thickness, and opacity in the controls panel
Your content here
1"use client";
2
3import { GridBackground } from "@/registry/ui/grid-background";
4
5export type GridBackgroundPlaygroundProps = {
6 size?: number;
7 thickness?: number;
8 opacity?: number;
9};
10
11export function GridBackgroundDefaultExample({
12 size = 40,
13 thickness = 1,
14 opacity = 0.4,
15}: GridBackgroundPlaygroundProps) {
16 return (
17 <div className="relative min-h-[460px] w-full overflow-hidden rounded-xl border border-border bg-background">
18 <GridBackground size={size} thickness={thickness} opacity={opacity} />
19
20 <div className="relative z-10 flex min-h-[460px] items-center justify-center p-10 text-sm text-muted-foreground">
21 Your content here
22 </div>
23 </div>
24 );
25}

Controls

size
thickness
opacity
Landing page
Mini landing layout with nav, hero, feature row, and grid overlay
Acme
Now in public beta

Build your next launch on a clean grid

A minimal landing shell: navigation, hero, and feature row over a decorative grid background.

Layout-first

Place sections inside a relative shell; the grid stays behind your page flow.

Themeable grid

Tune cell size, line color, thickness, and opacity to match your brand.

Drop-in overlay

Absolute inset layer with pointer-events-none so buttons and links stay interactive.

1"use client";
2
3import { GridBackground } from "@/registry/ui/grid-background";
4import { Button } from "@/components/ui/button";
5
6const LANDING_FEATURES = [
7 {
8 title: "Layout-first",
9 description:
10 "Place sections inside a relative shell; the grid stays behind your page flow.",
11 },
12 {
13 title: "Themeable grid",
14 description:
15 "Tune cell size, line color, thickness, and opacity to match your brand.",
16 },
17 {
18 title: "Drop-in overlay",
19 description:
20 "Absolute inset layer with pointer-events-none so buttons and links stay interactive.",
21 },
22] as const;
23
24export function GridBackgroundHeroExample() {
25 return (
26 <div className="relative w-full overflow-hidden rounded-xl border border-border bg-background">
27 <GridBackground size={32} />
28
29 <div className="relative z-10 flex min-h-[600px] flex-col">
30 <header className="flex items-center justify-between gap-4 px-6 py-4">
31 <span className="text-sm font-semibold tracking-tight">Acme</span>
32 <nav
33 className="hidden items-center gap-6 text-sm text-muted-foreground sm:flex"
34 aria-label="Primary"
35 >
36 <span>Product</span>
37 <span>Pricing</span>
38 <span>Docs</span>
39 </nav>
40 <Button size="sm" variant="outline">
41 Sign in
42 </Button>
43 </header>
44
45 <section className="flex flex-1 flex-col items-center justify-center px-6 py-14 text-center">
46 <span className="mb-4 inline-flex rounded-full border border-border/80 bg-muted/40 px-3 py-1 text-xs font-medium text-muted-foreground">
47 Now in public beta
48 </span>
49 <h1 className="max-w-lg text-3xl font-semibold tracking-tight sm:text-4xl">
50 Build your next launch on a clean grid
51 </h1>
52 <p className="mt-4 max-w-md text-sm leading-relaxed text-muted-foreground">
53 A minimal landing shell: navigation, hero, and feature row over a
54 decorative grid background.
55 </p>
56 <div className="mt-8 flex flex-wrap items-center justify-center gap-3">
57 <Button>Get started</Button>
58 <Button variant="outline">Book a demo</Button>
59 </div>
60 </section>
61
62 <section className="grid gap-4 px-6 py-8 sm:grid-cols-3">
63 {LANDING_FEATURES.map((feature) => (
64 <div
65 key={feature.title}
66 className="rounded-lg border border-border/60 bg-card/40 p-4 text-left backdrop-blur-sm"
67 >
68 <h2 className="text-sm font-medium">{feature.title}</h2>
69 <p className="mt-2 text-xs leading-relaxed text-muted-foreground">
70 {feature.description}
71 </p>
72 </div>
73 ))}
74 </section>
75 </div>
76 </div>
77 );
78}

Installation & source

Install via the shadcn CLI or copy the registry files manually.

bash
npx shadcn@latest add @tt-ui/grid-background

Props

NameTypeDefaultDescription
sizenumber40Size of the grid cells in pixels
thicknessnumber1Thickness of the grid lines in pixels
opacitynumber1Opacity of the grid background
classNamestringAdditional classes for the grid overlay layer