Join our Discord community
Interactive

Interactive Grid Pattern

Interactive SVG grid background component for React and Next.js applications. Built with TypeScript support, Tailwind CSS styling, and shadcn/ui design featuring hover effects, customizable dimensions, and responsive layouts.

Powered by

Loading component...

Installation

npx shadcn@latest add https://www.shadcn.io/registry/interactive-grid-pattern.json
npx shadcn@latest add https://www.shadcn.io/registry/interactive-grid-pattern.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/interactive-grid-pattern.json
bunx shadcn@latest add https://www.shadcn.io/registry/interactive-grid-pattern.json

Features

  • Interactive hover effects - Grid squares respond to mouse enter/leave events using JavaScript
  • SVG-based rendering - Crisp scaling at any resolution with minimal DOM impact for React apps
  • Tailwind CSS integration - Complete styling control with utility classes for Next.js projects
  • Customizable dimensions - Control grid size, cell dimensions, and interactive areas using TypeScript props
  • Performance optimized - Efficient rendering with minimal DOM nodes and smooth animations
  • Accessible design - Proper aria-hidden markup for decorative backgrounds using shadcn/ui patterns
  • Open source - Free interactive grid component with transform and mask support

Examples

Colorful Hover Effects

Loading component...

Multiple Variants

Loading component...

Use Cases

  • Hero backgrounds - Interactive grid overlays for landing page sections
  • Dashboard layouts - Subtle background patterns with hover feedback
  • Portfolio sites - Creative grid effects for design showcases
  • App interfaces - Decorative backgrounds with responsive interaction

API Reference

InteractiveGridPattern Props

PropTypeDefaultDescription
classNamestring-Additional CSS classes for the SVG element
widthnumber40Width of each grid cell in pixels
heightnumber40Height of each grid cell in pixels
squares[number, number][24, 24]Number of squares [horizontal, vertical]
squaresClassNamestring-CSS classes applied to interactive squares

Implementation

SVG-based with mouse event handlers on individual squares. Use squaresClassName for hover effects. Supports CSS transforms and mask-image for advanced effects. Marked as decorative for accessibility.