Getting Started
Blocks
Components
Device Mocks
Special Effects
Animations
Text Animations
Buttons
"use client";
import { cn } from "@/lib/utils";
import { InteractiveGridPattern } from "@/registry/magicui/interactive-grid-pattern";
export function InteractiveGridPatternDemo() {
return (
<div className="relative flex h-[500px] w-full flex-col items-center justify-center overflow-hidden rounded-lg border bg-background">
<InteractiveGridPattern
className={cn(
"[mask-image:radial-gradient(400px_circle_at_center,white,transparent)]",
"inset-x-0 inset-y-[-30%] h-[200%] skew-y-12",
)}
/>
</div>
);
}
Installation
pnpm dlx shadcn@latest add @magicui/interactive-grid-pattern
Examples
Colorful
"use client";
import { cn } from "@/lib/utils";
import { InteractiveGridPattern } from "@/registry/magicui/interactive-grid-pattern";
export function InteractiveGridPatternDemo() {
return (
<div className="relative flex h-[500px] w-full flex-col items-center justify-center overflow-hidden rounded-lg border bg-background">
<InteractiveGridPattern
className={cn(
"[mask-image:radial-gradient(400px_circle_at_center,white,transparent)]",
)}
width={20}
height={20}
squares={[80, 80]}
squaresClassName="hover:fill-blue-500"
/>
</div>
);
}
Usage
import { InteractiveGridPattern } from "@/components/magicui/interactive-grid-pattern";
<div className="relative h-[500px] w-full overflow-hidden">
<InteractiveGridPattern />
</div>
Props
Prop | Type | Default | Description |
---|---|---|---|
width | number | 40 | Width of each square in the grid |
height | number | 40 | Height of each square in the grid |
squares | [number, number] | [24,24] | Number of squares in the grid. First number is horizontal squares, second is vertical squares |
className | string | - | Class name applied to the grid container |
squaresClassName | string | - | Class name applied to individual squares in the grid |
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