JGuang

Pixel Image

Pixel Image · Magic UI

Preview
npx shadcn@latest add https://jiguang132.com/r/magic-ui/pixel-image.json

Some upstream demos use online images, videos or tweets. That content depends on network access and third-party services.

Pixel Image

Install: npx shadcn@latest add https://jiguang132.com/r/magic-ui/pixel-image.json

Use case

Reveal an image through animated pixel tiles.

Native props used by the examples

Extracted from all local examples for this entry, grouped by imported module and native owner, including other Magic components used by compound demos. This is not an exhaustive API or a universal host variant. Inspect spread object declarations and the source types/defaults below.

Owning component propExplanationExample source
PixelImage.src (pixel-image)Image or video source according to the owning component; audit loading and allowed URLs.examples/pixel-image-demo.tsx
PixelImage.customGrid (pixel-image)PixelImage row/column configuration.examples/pixel-image-demo.tsx
PixelImage.grayscaleAnimation (pixel-image)Animate image grayscale-to-color reveal.examples/pixel-image-demo.tsx

Interaction and state checks

  • Pixel Image Demo — pixel-image-demo

These names identify real example entries, not new component props or extra components. Check pointer/keyboard behavior, themes, small screens and failures for the selected example. Decorative effects must not invent disabled/error/submission states. Complete example installation includes the actual dependency closure.

Business integration boundary

customGrid sets rows/cols; grayscaleAnimation is a visual transition, not image generation. Large grids increase DOM/filter work.

Host and motion setup

Initialize Tailwind CSS v4, semantic CSS variables and the dark variant; import the independent local Registry namespace. Reuse an existing next-themes Provider without substituting JGuang UI/Base UI/HeroUI APIs. Mount effects in view and unmount offscreen; provide static alternatives for unavailable Canvas/WebGL or failed remote media. Respect prefers-reduced-motion and verify timer/RAF/observer/listener cleanup: stopping CSS alone does not prove the engine stopped. Examples provide no backend, login, payment or real AI stream. This practical guide is bilingual; detailed upstream references and demo text retain their original language.

Available examples

pixel-image-demo

Demo state and mock data do not provide a backend service. Inspect the component props before wiring real data.

Features

  • Pixelated image reveal animation
  • Customizable grid size and layout
  • Supports grayscale-to-color animation
  • Adjustable animation duration and delay
  • Lightweight and easy to use

Installation

<Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli">
npx shadcn@latest add @magicui/pixel-image
</TabsContent> <TabsContent value="manual"> <Steps>

<Step>Copy and paste the following code into your project.</Step>

<Step>Update the import paths to match your project setup.</Step>

</Steps> </TabsContent> </Tabs>

Usage

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

Props

PropTypeDefaultDescription
srcstring—The image source URL
grid"6x4" | "8x8" | "8x3" | "4x6" | "3x8""8x8"Predefined grid layout
customGrid{ rows: number; cols: number; }—Custom grid layout (overrides grid)
grayscaleAnimationbooleantrueWhether to animate from grayscale to color
pixelFadeInDurationnumber1000Duration (ms) for each pixel fade-in animation
maxAnimationDelaynumber1200Maximum random delay (ms) for pixel animation
colorRevealDelaynumber1500Delay (ms) before revealing color

Grid Type

// Predefined grid options
"6x4" | "8x8" | "8x3" | "4x6" | "3x8"

// Custom grid example
customGrid={{ rows: 5, cols: 10 }}

Note

  • Since the pixelation effect is purely decorative, make sure to provide text alternatives (like descriptions or labels) for any important content shown in the image. This ensures the content is accessible to screen reader users.

Credits

Complete example installation

The component command installs the component. Each example command also includes its actual imported components, native support UI, utilities and pinned dependencies. Helpers are not additional catalog components.

Pixel Image Demo

npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/pixel-image/pixel-image-demo.json

Default import: @/components/magicui/examples/pixel-image-demo

Dependencies: clsx@2.1.1, tailwind-merge@3.6.0

Minimal usage and theme

import Demo from '@/components/magicui/examples/pixel-image-demo';
import { ThemeProvider } from 'next-themes';
export default function Example() {
  return <ThemeProvider attribute="class" defaultTheme="system" enableSystem><Demo /></ThemeProvider>;
}

Initialize Tailwind CSS v4, semantic color variables and the dark variant first. Reuse an existing next-themes provider rather than nesting another. Next Link examples require a Next.js environment; in static Vite projects adapt the demo links to your router without changing the native component API. Some media and tweets require network access. Examples do not supply authentication or backend services.

Source-backed parameter reference

Implementation signatures and types are generated from the pinned local source. Optional props, native inherited types, union branches and never exclusions are preserved. A forwardRef implementation's ref is a React reference, not an additional business prop.

PixelImage({
  src,
  grid = "6x4",
  grayscaleAnimation = true,
  pixelFadeInDuration = 1000,
  maxAnimationDelay = 1200,
  colorRevealDelay = 1300,
  customGrid,
}: PixelImageProps)
type Grid = {
  rows: number
  cols: number
}

type PredefinedGridKey = keyof typeof DEFAULT_GRIDS

interface PixelImageProps {
  src: string
  grid?: PredefinedGridKey
  customGrid?: Grid
  grayscaleAnimation?: boolean
  pixelFadeInDuration?: number // in ms
  maxAnimationDelay?: number // in ms
  colorRevealDelay?: number // in ms
}

Destructuring defaults in source

Only defaults written directly in parameter/props destructuring are listed. Conditional expressions, runtime theme and computed values require source inspection; this is not an exhaustive behavior-default list.

// PixelImage
grid = "6x4"

// PixelImage
grayscaleAnimation = true

// PixelImage
pixelFadeInDuration = 1000

// PixelImage
maxAnimationDelay = 1200

// PixelImage
colorRevealDelay = 1300