Flickering Grid
A flickering grid background made with SVGs, fully customizable using Tailwind CSS.
import { FlickeringGrid } from '@/registry/magicui/flickering-grid'
export function FlickeringGridDemo() { return ( <div class=" relative h-125 w-full overflow-hidden rounded-lg border bg-background " > <FlickeringGrid class="absolute inset-0 z-0 size-full" squareSize={4} gridGap={6} color="#6B7280" maxOpacity={0.5} flickerChance={0.1} height={800} width={800} /> </div> )}Installation
Section titled “Installation”pnpm dlx shadcn@latest add @magicui-solid/flickering-gridbunx shadcn@latest add @magicui-solid/flickering-gridyarn dlx shadcn@latest add @magicui-solid/flickering-gridnpx shadcn@latest add @magicui-solid/flickering-gridExamples
Section titled “Examples”Rounded
Section titled “Rounded”import { FlickeringGrid } from '@/registry/magicui/flickering-grid'
export function FlickeringGridRoundedDemo() { return ( <div class=" relative size-150 w-full overflow-hidden rounded-lg border bg-background " > <FlickeringGrid class=" relative inset-0 z-0 mask-[radial-gradient(450px_circle_at_center,white,transparent)] " squareSize={4} gridGap={6} color="#60A5FA" maxOpacity={0.5} flickerChance={0.1} height={800} width={800} /> </div> )}import { FlickeringGrid } from '@/components/magicui/flickering-grid'<FlickeringGrid />| Prop | Type | Default | Description |
|---|---|---|---|
squareSize |
number |
4 |
Size of each square in the grid |
gridGap |
number |
6 |
Gap between squares in the grid |
flickerChance |
number |
0.3 |
Probability of a square flickering |
color |
string |
"rgb(0, 0, 0)" |
Color of the squares |
width |
number |
- |
Width of the canvas |
height |
number |
- |
Height of the canvas |
class |
string |
- |
Additional CSS classes for the canvas |
maxOpacity |
number |
0.3 |
Maximum opacity of the squares |
Original:
magicui.design/docs/components/flickering-grid