Join our Discord community
Special effects

Pixel Image

Pixelated image reveal component for React and Next.js applications. Built with TypeScript support, Tailwind CSS styling, and shadcn/ui design featuring grid animations, grayscale transitions, and customizable timing.

Loading component...

Installation

npx shadcn@latest add https://www.shadcn.io/registry/pixel-image.json
npx shadcn@latest add https://www.shadcn.io/registry/pixel-image.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/pixel-image.json
bunx shadcn@latest add https://www.shadcn.io/registry/pixel-image.json

Features

  • Pixelated reveals - Grid-based image animations with customizable patterns using CSS clip-path
  • Grayscale transitions - Smooth color reveals for dramatic visual impact using JavaScript timing
  • Custom grids - 5 predefined layouts plus custom dimensions (1x1 to 16x16) using TypeScript props
  • Staggered timing - Configurable delays and durations for pixel appearance using React state
  • Replay functionality - Optional button for restarting animations in Next.js applications
  • Performance optimized - CSS transforms with GPU acceleration using Tailwind CSS utilities
  • Accessibility features - Alt text and reduced motion support using shadcn/ui patterns
  • Open source - Free component with deterministic randomization and responsive design

Examples

Basic Pixel Effect

Loading component...

Custom Grid Pattern

Loading component...

No Animation (Static)

Loading component...

With Replay Button

Loading component...

API Reference

PixelImage

PropTypeDefaultDescription
srcstringrequiredThe image source URL to display with pixelated reveal effect
grid"6x4" | "8x8" | "8x3" | "4x6" | "3x8""6x4"Predefined grid pattern for pixelation. Each option creates different visual styles
customGrid{ rows: number; cols: number }undefinedCustom grid dimensions that override predefined grids. Values must be 1-16
grayscaleAnimationbooleantrueEnables smooth transition from grayscale to full color during reveal
pixelFadeInDurationnumber1000Duration in milliseconds for each pixel's fade-in animation
maxAnimationDelaynumber1200Maximum stagger delay in milliseconds between pixel appearances
colorRevealDelaynumber1300Delay in milliseconds before grayscale-to-color transition begins
showReplayButtonbooleanfalseShows an overlay replay button to restart the animation sequence

Grid Constraints

  • Custom grid rows and columns must be integers between 1 and 16
  • Invalid custom grids will fallback to the selected predefined grid
  • Higher grid values create more detailed pixelation effects
  • Lower grid values create larger, more prominent pixels

Predefined Grids

  • 6x4: 6 columns × 4 rows (24 pixels) - Default balanced grid
  • 8x8: 8 columns × 8 rows (64 pixels) - High detail square grid
  • 8x3: 8 columns × 3 rows (24 pixels) - Wide format grid
  • 4x6: 4 columns × 6 rows (24 pixels) - Tall format grid
  • 3x8: 3 columns × 8 rows (24 pixels) - Ultra-wide grid

Use Cases

  • Creative portfolios - Artistic image reveals for photography and design showcases
  • Gaming interfaces - Retro 8-bit and pixel art aesthetic implementations
  • Loading animations - Engaging image reveals during content loading states
  • Interactive galleries - Unique pixelated transitions for art and media displays

Implementation

Built with CSS clip-path for efficient rendering. Uses staggered animations with deterministic randomization. Supports custom grids and replay functionality. Optimized for performance with GPU acceleration.