Depth Grid

The hovered item lifts toward you while the rest sink back. Pure CSS.

no dependenciesMIT · free

Installation

npx shadcn@latest add https://ombakui.com/r/depth-grid.json

Usage

import { DepthGrid } from "@/components/depth-grid";

<DepthGrid className="grid-cols-3 gap-4">
  {photos.map((p) => <img key={p.id} src={p.src} alt="" />)}
</DepthGrid>

Props

PropTypeDefaultDescription
children*ReactNode–Each direct child becomes a cell.
depthnumber0.5How far the other cells recede, 0–1.
blurbooleantrueBlur the cells that recede.
classNamestring"grid-cols-2 gap-4 md:grid-cols-3"Grid classes, e.g. "grid-cols-3 gap-4".