Getting Started
Components
Device Mocks
Special Effects
Animations
Text Animations
Buttons
import { cn } from "@/lib/utils";
import { AnimatedGridPattern } from "@/registry/magicui/animated-grid-pattern";
export function AnimatedGridPatternDemo() {
return (
<div className="relative flex h-[500px] w-full items-center justify-center overflow-hidden rounded-lg border bg-background p-20">
<AnimatedGridPattern
numSquares={30}
maxOpacity={0.1}
duration={3}
repeatDelay={1}
className={cn(
"[mask-image:radial-gradient(500px_circle_at_center,white,transparent)]",
"inset-x-0 inset-y-[-30%] h-[200%] skew-y-12",
)}
/>
</div>
);
}
Installation
pnpm dlx shadcn@latest add @magicui/animated-grid-pattern
Usage
import { AnimatedGridPattern } from "@/components/magicui/animated-grid-pattern";
<AnimatedGridPattern />
Props
GridPattern
Prop | Type | Default | Description |
---|---|---|---|
className | string | - | Additional classes to be added to the pattern |
width | number | 40 | Width of the pattern |
height | number | 40 | Height of the pattern |
x | number | -1 | X offset of the pattern |
y | number | -1 | Y offset of the pattern |
strokeDasharray | number | 0 | Stroke dash array of the pattern |
numSquares | number | 200 | Number of squares in the pattern |
maxOpacity | number | 0.5 | Maximum opacity of the pattern |
duration | number | 1 | Duration of the animation |
repeatDelay | number | 0.5 | Repeat delay of the animation |
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