Grid Beams
A decorative animated grid background with traveling beams. Drop-in overlay layer - place content in a relative shell on top.
Default
Default grid beams with placeholder content overlay
Your content here
default-example.tsx
1"use client";23import { GridBeams } from "@/registry/ui";45export function GridBeamsDefaultExample() {6 return (7 <div className="relative min-h-[460px] w-full overflow-hidden rounded-xl border border-border bg-background">8 <GridBeams />910 <div className="relative z-10 flex min-h-[460px] items-center justify-center p-10 text-sm text-muted-foreground">11 Your content here12 </div>13 </div>14 );15}
E2E Beams
No random starting positions
Edge-to-Edge Beams
Classic grid beam effect starting from edges with no random starting positions.
edge-to-edge-example.tsx
1"use client";23import { GridBeams } from "@/registry/ui";45export function GridBeamsEdgeToEdgeExample() {6 return (7 <div className="relative min-h-[460px] w-full overflow-hidden rounded-xl border border-border bg-background">8 <GridBeams9 randomStarts={false}10 beamLength={{ min: 0.5, max: 0.9 }}11 baseSpeed={0.7}12 />1314 <div className="relative z-10 flex min-h-[460px] flex-col items-center justify-center px-6 text-center">15 <h2 className="text-2xl font-semibold tracking-tight">16 Edge-to-Edge Beams17 </h2>18 <p className="mt-3 max-w-md text-sm text-muted-foreground">19 Classic grid beam effect starting from edges with no random starting20 positions.21 </p>22 </div>23 </div>24 );25}
Quick Pulses
Short, quick pulses across the grid
Quick Pulses
Short, quick pulses across the grid with a pulse animation pattern.
quick-pulses-example.tsx
1"use client";23import { GridBeams } from "@/registry/ui";45export function GridBeamsQuickPulsesExample() {6 return (7 <div className="relative min-h-[460px] w-full overflow-hidden rounded-xl border border-border bg-background">8 <GridBeams9 randomStarts10 beamLength={{ min: 0.1, max: 0.3 }}11 baseSpeed={1.5}12 defaultPattern="pulse"13 colors={["#60A5FA", "#818CF8", "#A78BFA"]}14 />1516 <div className="relative z-10 flex min-h-[460px] flex-col items-center justify-center px-6 text-center">17 <h2 className="text-2xl font-semibold tracking-tight">Quick Pulses</h2>18 <p className="mt-3 max-w-md text-sm text-muted-foreground">19 Short, quick pulses across the grid with a pulse animation pattern.20 </p>21 </div>22 </div>23 );24}
Slow Motion Grid
Slow moving beams.
Slow Motion Grid
Custom animation with slow-moving beams and wider grid cells.
slow-motion-example.tsx
1"use client";23import { GridBeams } from "@/registry/ui";45export function GridBeamsSlowMotionExample() {6 return (7 <div className="relative min-h-[460px] w-full overflow-hidden rounded-xl border border-border bg-background">8 <GridBeams9 baseSpeed={0.5}10 beamDelay={{ min: 100, max: 500 }}11 defaultPattern="pulse"12 colors={["#60A5FA", "#818CF8", "#A78BFA", "#C084FC"]}13 gridSize={50}14 />1516 <div className="relative z-10 flex min-h-[460px] flex-col items-center justify-center px-6 text-center">17 <h2 className="text-2xl font-semibold tracking-tight">18 Slow Motion Grid19 </h2>20 <p className="mt-3 max-w-md text-sm text-muted-foreground">21 Custom animation with slow-moving beams and wider grid cells.22 </p>23 </div>24 </div>25 );26}
Mostly Accelerating Beams
Beams that accelerate and decelerate.
Mostly Accelerating Beams
More accelerate-decelerate pattern beams with a higher beam count.
mostly-accelerating-example.tsx
1"use client";23import { GridBeams } from "@/registry/ui";45export function GridBeamsMostlyAcceleratingExample() {6 return (7 <div className="relative min-h-[460px] w-full overflow-hidden rounded-xl border border-border bg-background">8 <GridBeams9 patternDistribution={{10 steady: 0.2,11 pulse: 0.2,12 "accelerate-decelerate": 0.6,13 }}14 initialBeams={15}15 maxBeams={20}16 />1718 <div className="relative z-10 flex min-h-[460px] flex-col items-center justify-center px-6 text-center">19 <h2 className="text-2xl font-semibold tracking-tight">20 Mostly Accelerating Beams21 </h2>22 <p className="mt-3 max-w-md text-sm text-muted-foreground">23 More accelerate-decelerate pattern beams with a higher beam count.24 </p>25 </div>26 </div>27 );28}
Installation & source
Install via the shadcn CLI or copy the registry files manually.
bash
npx shadcn@latest add @tt-ui/grid-beams
Props
| Name | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional classes for the overlay layer |
| gridColor | string | rgba(128,128,128,0.12) | Color of the static grid lines |
| baseSpeed | number | 1.0 | Base speed of the grid beams |
| maxBeams | number | 14 | Maximum number of beams |
| initialBeams | number | 10 | Initial number of beams |
| beamDelay | object | { min: 0, max: 200 } | Delay configuration for beams |
| defaultPattern | string | steady | Default pattern for beams. Use "Steady", "Pulse", or "Accelerate-Decelerate" |
| patternDistribution | object | { steady: 0.3, pulse: 0.4, 'accelerate-decelerate': 0.3 } | Distribution of patterns. Must sum up to 1. |
| colors | string[] | ['#3B82F6', '#8B5CF6', '#EC4899', '#10B981'] | Custom colors for beams |
| gridSize | number | 40 | Size of grid cells in pixels |