Skip to content
WANCRAFT

E.201Backgrounds & Effects

Tile Reveal

Content revealed by a grid of tiles flipping, shrinking or dropping away in a wave — on view, on click or from a prop.

NewReactCSSTailwindintermediate

Overview

Tile Reveal covers any content with a grid of tiles and clears them in a wave as an entrance or transition. The wave can start at a corner, the centre or the pointer, run in a left-to-right sweep, or pick tiles in a deterministic random order; each tile flips edge-on, shrinks or drops away with its own staggered delay, so the whole reveal takes exactly the duration you set. Tiles are plain DOM elements animated with CSS transitions (capped at 200, no animation loop). It triggers when scrolled into view, on click — the cover is then a real button with a label, and focus moves to the content afterwards — or from the revealed prop. The content is inert until the last tile is gone, the cover can be theme ink, the accent or a mixed checker, and reduced motion cross-fades the whole cover instead.

01Installation

Method 01 · Registry

CLI verified

Uses the shadcn CLI in a project initialised with shadcn init. Installs the file to components/ui/tile-reveal.tsx and adds its dependencies.

npx shadcn@latest add https://wancraft.my/r/tile-reveal.json

Method 02 · Copy and paste

  1. 1. No extra dependencies — React and Tailwind CSS only.
  2. 2. Copy the source from the Code tab into components/ui/tile-reveal.tsx.
  3. 3. Import it and adjust props.
Dependencies
None
Peer
react ≥ 18, tailwindcss ≥ 4
Added
13 Oct 2026
Updated
—

02Usage

The default configuration. Change properties above to generate a tailored example in the Usage tab.

example.tsx
import { TileReveal } from "@/components/ui/tile-reveal";

export function TileRevealExample() {
  return (
    <TileReveal className="aspect-[16/10] w-full max-w-xl rounded-xl">
      <div className="grid h-full place-items-center bg-zinc-100 p-8 text-2xl font-medium tracking-tight dark:bg-zinc-900">
        Hello, tiles.
      </div>
    </TileReveal>
  );
}

03Props

PropTypeDefaultDescription
childrenReactNode—The content under the cover (required); inert until the reveal finishes.
rowsnumber6Tile rows. rows × cols is capped at 200 by shrinking the larger side.
colsnumber10Tile columns.
pattern"corner" | "center" | "pointer" | "random" | "sweep""corner"Where the wave starts. Pointer uses the press or last pointer position (centre for keyboard).
effect"flip" | "scale" | "drop""flip"How each tile leaves.
durationnumber1100Total reveal time in ms; each tile takes ~42% of it and the rest is the stagger.
tone"ink" | "accent" | "mixed""ink"Cover colouring: theme ink, solid accent, or an ink checker with accent tiles.
accentstring"#FF7448"Accent for the accent and mixed tones and the focus ring.
trigger"view" | "click" | "manual""view"Reveal when 35% visible, on pressing the cover button, or when revealed becomes true.
revealedboolean—With trigger="manual": true reveals, false covers again instantly.
labelstring"Reveal"Accessible name and visible label of the cover button (click trigger).
onReveal() => void—Called when the last tile is gone and the content is interactive.
...propsHTMLAttributes<HTMLDivElement>—Forwarded to the root (relative, overflow-hidden; size it with className).

04Features

  • 01Five wave origins: corner, centre, pointer, deterministic random and sweep
  • 02Flip, scale or drop per tile, staggered so the whole reveal takes exactly the set duration
  • 03DOM tiles with CSS transitions only — capped at 200 tiles, no animation loop
  • 04Triggers on view (IntersectionObserver), on click, or from the revealed prop
  • 05Ink, accent or mixed-checker cover; hairline tile seams
  • 06SSR-stable: tile order is computed from props only
motion · staggermotion · tweeninput · viewportinput · clickinput · keyboard

05Accessibility

  • The covered content is inert (unfocusable and hidden from assistive tech) until the last tile is gone.
  • With the click trigger the cover is a real button with an accessible name and a visible focus ring; Enter or Space reveals from the centre and focus then moves to the content.
  • Tiles are decorative and hidden from assistive tech.
  • prefers-reduced-motion replaces the tile wave with a short cross-fade of the whole cover.

06Limitations

  • Content stays inert until revealed, so with JavaScript disabled it remains covered.
  • Covering again (revealed → false) is instant; only the reveal animates.