import { Cards3D } from "@/components/3d/cards";
export default function Example() {
return (
<div style={{ height: 420 }}>
<Cards3D
variant="holographic"
theme="light"
/>
</div>
);
}
Deps: framer-motion, lucide-react
Installation
Install the runtime dependencies, then copy the component module (and the shared 3D core when the component uses WebGL).
npm install framer-motion lucide-react
# Copy the component module
cp -r src/components/3d/cards <your-project>/src/components/3d/cardsDependencies: framer-motion, lucide-react
Usage
Every category module exposes one typed component. Pick an implementation with variant and pass props grouped by concern.
import { Cards3D } from "@/components/3d/cards";
export default function Example() {
return (
<div style={{ height: 420 }}>
<Cards3D
variant="holographic"
theme="light"
/>
</div>
);
}
React implementation
With every prop set explicitly. The complete, copyable source of src/components/3d/cards/index.tsx is available in the playground’s Source tab.
import { Cards3D } from "@/components/3d/cards";
export default function Example() {
return (
<div style={{ height: 420 }}>
<Cards3D
variant="holographic"
theme="amoled"
title="Depth Study No. 4"
subtitle="A quiet exploration of light and space."
accent="#5255ff"
tilt={12}
perspective={1000}
glare
speed={1}
elevation={24}
radius={8}
reducedMotion={false}
/>
</div>
);
}
Next.js implementation
This component is DOM based, but it is still code-split with next/dynamic so interaction code ships only where it's used.
// app/holographic-card/page.tsx (Next.js App Router)
"use client";
import dynamic from "next/dynamic";
// Heavy interactive code is split into its own chunk.
const Cards3D = dynamic(
() => import("@/components/3d/cards").then((m) => m.Cards3D),
{ ssr: false, loading: () => <div aria-busy="true" style={{ height: 420 }} /> },
);
export default function Page() {
return (
<main>
<div style={{ height: 420 }}>
<Cards3D
variant="holographic"
theme="light"
/>
</div>
</main>
);
}
TypeScript interfaces
export type Theme = "light" | "amoled";
export interface HolographicCardProps {
/** Which 3D Cards implementation to render */
variant: "holographic";
theme: Theme;
/* Content */
title?: string; // default "Depth Study No. 4"
subtitle?: string; // default "A quiet exploration of light and space."
/* Visual */
accent?: string; // default "#5255ff"
glare?: boolean; // default true
elevation?: number; // 0–48, default 24
radius?: number; // 0–24, default 8
/* Interaction */
tilt?: number; // 0–30, default 12
/* Camera */
perspective?: number; // 400–2000, default 1000
/* Animation */
speed?: number; // 0.3–3, default 1
/* Accessibility */
reducedMotion?: boolean; // default false
}
Props reference
| Prop | Type | Default | Group | Description |
|---|---|---|---|---|
| variant | "holographic" | — | Core | Selects the implementation. |
| theme | "light" | "amoled" | — | Core | Themes surfaces, materials and lighting. |
| title | string | "Depth Study No. 4" | Content | Title |
| subtitle | string | "A quiet exploration of light and space." | Content | Subtitle |
| accent | string (hex) | "#5255ff" | Visual | Accent |
| tilt | number | 12 | Interaction | Tilt / parallax strength (°) (0 – 30) |
| perspective | number | 1000 | Camera | Perspective (px) (400 – 2000) |
| glare | boolean | true | Visual | Glare highlight |
| speed | number | 1 | Animation | Spring speed (0.3 – 3) |
| elevation | number | 24 | Visual | Elevation (px) (0 – 48) |
| radius | number | 8 | Visual | Corner radius (px) (0 – 24) |
| reducedMotion | boolean | false | Accessibility | Force reduced motion |
Customization
Colour props accept any hex string. Content props accept plain strings. Every value shown in the playground maps 1:1 to a prop, so you can design visually and copy the generated code. Use Share to send a pre-configured link or Export to download the configuration JSON.
import { Cards3D } from "@/components/3d/cards";
export default function Example() {
return (
<div style={{ height: 420 }}>
<Cards3D
variant="holographic"
theme="light"
accent="#ff5a36"
/>
</div>
);
}
Animation settings
- tiltTilt / parallax strength (°) · 0–30
- speedSpring speed · 0.3–3
All motion is suspended when prefers-reduced-motion is on.
Theme support
Pass theme="light" or theme="amoled". Surfaces, borders, shadows and text switch via CSS variables (--bg, --card, --fg, --border, --accent). AMOLED uses true #000000. Use the theme switch in the playground toolbar to preview both.
Responsive behavior
The component fills its parent, so size it with the container. Use the playground’s desktop / tablet / mobile selector to test. Layouts use fluid widths and container-relative sizing.
Accessibility notes
- — Interactive cards use real buttons, links or form controls, never click handlers on divs.
- — Decorative layers are aria-hidden; 3D tilt is disabled for reduced-motion users.
- — Flip and expand cards expose aria-pressed / aria-expanded.
Performance notes
- — Tilt uses transform-only animation, which stays on the compositor.
- — Springs are driven by motion values, so pointer movement doesn't trigger React renders.
- — Artwork is generated SVG — zero network requests.
Related components
- Floating Profile CardA profile card whose avatar floats off the surface, with a working follow button.
- Product Showcase CardA product tile with live colour swatches and an add-to-cart counter.
- Interactive NFT CardA foil collectible card with a live auction countdown and bidding.
- Perspective Image CardAn image panel set at an angle that flattens on hover.