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.
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
Custom Grid Pattern
No Animation (Static)
With Replay Button
API Reference
PixelImage
Prop | Type | Default | Description |
---|---|---|---|
src | string | required | The 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 } | undefined | Custom grid dimensions that override predefined grids. Values must be 1-16 |
grayscaleAnimation | boolean | true | Enables smooth transition from grayscale to full color during reveal |
pixelFadeInDuration | number | 1000 | Duration in milliseconds for each pixel's fade-in animation |
maxAnimationDelay | number | 1200 | Maximum stagger delay in milliseconds between pixel appearances |
colorRevealDelay | number | 1300 | Delay in milliseconds before grayscale-to-color transition begins |
showReplayButton | boolean | false | Shows 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.
Motion Highlight
Versatile highlight component with smooth animations for interactive UI elements. Perfect for React applications requiring dynamic visual feedback with Next.js integration and TypeScript support.
Calendar
Feature calendar grid component for React and Next.js applications. Built with TypeScript support, Tailwind CSS styling, and shadcn/ui design featuring drag-and-drop, date selection, and internationalization.