Getting Started
Components
Device Mocks
Special Effects
Animations
Text Animations
Buttons
import { FlickeringGrid } from "@/registry/magicui/flickering-grid";
export function FlickeringGridDemo() {
return (
<div className="relative h-[500px] w-full overflow-hidden rounded-lg border bg-background">
<FlickeringGrid
className="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
pnpm dlx shadcn@latest add @magicui/flickering-grid
Examples
Rounded
import { FlickeringGrid } from "@/registry/magicui/flickering-grid";
export function FlickeringGridRoundedDemo() {
return (
<div className="relative size-[600px] w-full overflow-hidden rounded-lg border bg-background">
<FlickeringGrid
className="relative inset-0 z-0 [mask-image: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>
);
}
Usage
import { FlickeringGrid } from "@/components/magicui/flickering-grid";
<FlickeringGrid />
Props
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 |
className | string | - | Additional CSS classes for the canvas |
maxOpacity | number | 0.2 | Maximum opacity of the squares |
Limited Time Offer
Ship Faster with Magic UI ProMagic UI Pro
Stop building from scratch.
Get 8 production-ready templates and 50+ premium components that your users will love.
✓
Next.js 15 + TypeScript ready✓
Copy, paste, customize in minutes✓
Save 100+ hours of development