Skip to main content

Installation

    Usage

    showLineNumbers
    import { PixelImage } from "@/components/ui/pixel-image"
    
    showLineNumbers
    <PixelImage src="/image.jpg" grid="8x8" />
    

    Props

    PropTypeDefaultDescription
    srcstring-The image source URL (required).
    grid"6x4" | "8x8" | "8x3" | "4x6" | "3x8""6x4"Predefined grid size for the pixel effect.
    customGrid{ rows: number, cols: number }-Custom grid size (1-16 for both rows and cols).
    grayscaleAnimationbooleantrueWhether to animate from grayscale to color.
    pixelFadeInDurationnumber1000Duration of the fade-in animation in milliseconds.
    maxAnimationDelaynumber1200Maximum random delay for pixel animations in milliseconds.
    colorRevealDelaynumber1300Delay before revealing color in milliseconds.

    Examples

    Custom Grid Size

    showLineNumbers
    <PixelImage 
      src="/image.jpg" 
      customGrid={{ rows: 10, cols: 10 }}
      pixelFadeInDuration={1500}
    />
    

    Without Grayscale Animation

    showLineNumbers
    <PixelImage 
      src="/image.jpg" 
      grid="8x8"
      grayscaleAnimation={false}
    />
    

    Build docs developers (and LLMs) love