Loading preview
Holo Card
CardsA payment card with a holographic foil that follows the pointer, and a flip to the back on click.
A card that tilts toward the pointer while its layers rise off the surface, each to its own depth.
npx shadcn@latest add @venusui/depth-cardRun this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.
Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.
@/components/ui/depth-card.tsxThe code behind the preview above.
depth-card-demo.tsx
import { ArrowRight } from "lucide-react"
import { DepthCard, DepthCardItem } from "@/components/ui/depth-card"
// Photo: Unsplash (free under the Unsplash License).
const PHOTO = "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=900&h=560&fit=crop&auto=format&q=80"
export default function DepthCardDemo() {
return (
<DepthCard className="w-[min(26rem,calc(100vw-3rem))] rounded-2xl border bg-card p-6 text-card-foreground shadow-sm">
<DepthCardItem depth={50}>
<h3 className="text-xl font-semibold tracking-tight">Lift every layer</h3>
</DepthCardItem>
<DepthCardItem depth={60} className="mt-2">
<p className="text-sm leading-6 text-muted-foreground">
Move your pointer over the card. Each layer has its own depth, so the photo rises above the text.
</p>
</DepthCardItem>
<DepthCardItem depth={100} className="relative mt-5">
<img
src={PHOTO}
alt="Snowy mountain peaks rising above a sea of clouds at sunset."
width={900}
height={560}
className="aspect-[16/10] w-full rounded-xl object-cover shadow-none transition-shadow duration-500 group-data-active/depth-card:shadow-2xl group-data-active/depth-card:shadow-black/25"
/>
<DepthCardItem depth={40} className="absolute top-3 left-3">
<span className="rounded-full bg-black/55 px-2.5 py-1 text-xs font-medium text-white backdrop-blur">Above the clouds</span>
</DepthCardItem>
</DepthCardItem>
<div className="mt-6 flex items-center justify-between transform-3d">
<DepthCardItem depth={30} x={-8}>
<a href="#" className="inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground">
Read the guide <ArrowRight aria-hidden="true" className="size-3.5" />
</a>
</DepthCardItem>
<DepthCardItem depth={30} x={8}>
<a href="#" className="inline-flex h-9 items-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground hover:bg-primary/90">
Get started
</a>
</DepthCardItem>
</div>
</DepthCard>
)
}
| Prop | Type | Default | Description |
|---|---|---|---|
| max | number | 12 | DepthCard: largest tilt in degrees. |
| perspective | number | 1000 | DepthCard: distance to the viewer in px. Smaller values exaggerate the depth. |
| containerClassName | string | — | DepthCard: class for the outer element that holds the perspective. |
| depth | number | 0 | DepthCardItem: how far the layer rises toward the viewer while the card is active, in px. |
| x, y | number | 0 | DepthCardItem: sideways and vertical shift while active, in px. |
| rotateX, rotateY, rotateZ | number | 0 | DepthCardItem: extra rotation while active, in degrees. |
Both accept all <div> props. DepthCard's className styles the card itself (border, background, padding).
depth: 80–120px for a photo, 20–60px for text and buttons.group-data-active/depth-card:, e.g. a deeper shadow on the photo as in the demo.div with transform-3d, so each keeps its own depth.DepthCardItem and the card must keep 3D: add transform-3d, and remove overflow-hidden (clipping flattens 3D). Round images on the image itself instead.max small (8–12) and depths under ~120px for crisp text.Unknown registry "@venusui"npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.No components.json foundnpx shadcn@latest init in your project first.A payment card with a holographic foil that follows the pointer, and a flip to the back on click.
A card that tilts in 3D toward the pointer, with a glare that follows it.
Cards arranged in a ring that turns in 3D, with buttons, arrow keys and announcements.