WebberUI

Pixel Reveal Card

A card that reveals its content through a pixel dissolve

Colored pixels covering the card's content fade out cell by cell in a specified order, revealing what lies beneath like a mosaic blown away by the wind. Hover and enter-the-viewport triggers are both supported, and the whole effect is drawn on a 2D canvas for steady performance.

Loading preview…
npx shadcn@latest add https://webberui.com/r/pixel-reveal-card.json

Playground

Tune the props live — the code snippet updates as you go, so you can dial in the look you want before copying it.

16
0.9
<PixelRevealCard />

Installation

npx shadcn@latest add https://webberui.com/r/pixel-reveal-card.json

Or, once registries are configured in components.json, install it as @webberui/pixel-reveal-card.

Usage

import { PixelRevealCard } from "@/components/ui/pixel-reveal-card";

<PixelRevealCard trigger="hover" pixelSize={14} className="h-[300px] w-[260px]">
  <div className="flex h-full w-full flex-col justify-end bg-gradient-to-br from-indigo-500 to-fuchsia-500 p-5 text-white">
    <h3 className="text-xl font-semibold">Nebula Pass</h3>
    <p className="mt-1 text-sm text-white/80">Hover to reveal.</p>
  </div>
</PixelRevealCard>

Write the card content in children as usual; while it is covered the content is still in the DOM and readable by assistive technology. The container has no height by default, so give it an explicit size through className (for example h-[300px] w-[260px]).

Props

PropTypeDefaultDescription
childrenReact.ReactNodeThe card content to be revealed
trigger"hover" | "view""hover"How it is triggered: toggle on hover, or reveal automatically on entering the viewport
pixelSizenumber16Edge length of a single pixel (px); smaller values give finer grain
colorsstring[]four indigo-to-magenta colorsColors of the overlay layer, picked at random per cell to form the mosaic
direction"random" | "left" | "right" | "top" | "bottom" | "diagonal""random"Ordering direction of the pixel dissolve
durationnumber0.9Time a full dissolve or refill takes (seconds)
oncebooleantrueWhether to reveal only once when trigger="view"
classNamestringForwarded to the outermost container; use it to set the size and styles

Accessibility

  • When the user has "reduce motion" enabled at the system level, the content shows directly and no pixel overlay is drawn
  • The content stays in the DOM while covered, and the canvas overlay is marked aria-hidden, so it does not affect what assistive technology announces
  • In hover mode the card can be focused with the keyboard (focus reveals, blur refills)

On this page