UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
---
title: Interactive Grid Pattern
date: 2024-12-31
description: A interactive background grid pattern made with SVGs, fully customizable using Tailwind CSS.
author: h3rmel
published: true
---
<ComponentPreview name="interactive-grid-pattern-demo" />
## Installation
<Tabs defaultValue="cli">
<TabsList>
<TabsTrigger value="cli">CLI</TabsTrigger>
<TabsTrigger value="manual">Manual</TabsTrigger>
</TabsList>
<TabsContent value="cli">
```bash
npx shadcn@latest add @magicui/interactive-grid-pattern
```
</TabsContent>
<TabsContent value="manual">
<Steps>
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource name="interactive-grid-pattern" />
<Step>Update the import paths to match your project setup.</Step>
</Steps>
</TabsContent>
</Tabs>
## Examples
### Colorful
<ComponentPreview name="interactive-grid-pattern-demo-2" />
### Usage
```tsx showLineNumbers
import { InteractiveGridPattern } from "@/components/ui/interactive-grid-pattern"
```
```tsx showLineNumbers
<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 |