import { Gallery3D } from "@/components/3d/gallery";
export default function Example() {
return (
<div style={{ height: 420 }}>
<Gallery3D
variant="circular"
theme="light"
/>
</div>
);
}
Deps: three, @react-three/fiber, @react-three/drei, 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 three @react-three/fiber @react-three/drei framer-motion lucide-react
# Copy the component module
cp -r src/components/3d/gallery <your-project>/src/components/3d/gallery
# Copy the shared 3D core
cp -r src/components/3d/core <your-project>/src/components/3d/coreDependencies: three, @react-three/fiber, @react-three/drei, framer-motion, lucide-react
Usage
Every category module exposes one typed component. Pick an implementation with variant and pass props grouped by concern.
import { Gallery3D } from "@/components/3d/gallery";
export default function Example() {
return (
<div style={{ height: 420 }}>
<Gallery3D
variant="circular"
theme="light"
/>
</div>
);
}
React implementation
With every prop set explicitly. The complete, copyable source of src/components/3d/gallery/index.tsx is available in the playground’s Source tab.
import { Gallery3D } from "@/components/3d/gallery";
export default function Example() {
return (
<div style={{ height: 420 }}>
<Gallery3D
variant="circular"
theme="amoled"
speed={1}
quality="medium"
reducedMotion={false}
/>
</div>
);
}
Next.js implementation
WebGL needs the browser. Load the scene through next/dynamic with ssr disabled and a sized placeholder to avoid layout shift.
// app/circular-image-gallery/page.tsx (Next.js App Router)
"use client";
import dynamic from "next/dynamic";
// WebGL must never run on the server — load the scene client-side only.
const Gallery3D = dynamic(
() => import("@/components/3d/gallery").then((m) => m.Gallery3D),
{ ssr: false, loading: () => <div aria-busy="true" style={{ height: 420 }} /> },
);
export default function Page() {
return (
<main>
<div style={{ height: 420 }}>
<Gallery3D
variant="circular"
theme="light"
/>
</div>
</main>
);
}
TypeScript interfaces
export type Theme = "light" | "amoled";
export interface CircularImageGalleryProps {
/** Which 3D Media & Gallery implementation to render */
variant: "circular";
theme: Theme;
/* Animation */
speed?: number; // 0.2–3, default 1
/* Rendering */
quality?: "low" | "medium" | "high"; // default "medium"
/* Accessibility */
reducedMotion?: boolean; // default false
}
Props reference
| Prop | Type | Default | Group | Description |
|---|---|---|---|---|
| variant | "circular" | — | Core | Selects the implementation. |
| theme | "light" | "amoled" | — | Core | Themes surfaces, materials and lighting. |
| speed | number | 1 | Animation | Animation speed (0.2 – 3) |
| quality | "low" | "medium" | "high" | "medium" | Rendering | Quality preset |
| 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 { Gallery3D } from "@/components/3d/gallery";
export default function Example() {
return (
<div style={{ height: 420 }}>
<Gallery3D
variant="circular"
theme="light"
/>
</div>
);
}
Animation settings
- speedAnimation speed · 0.2–3
All motion is suspended when prefers-reduced-motion is on.
Theme support
Pass theme="light" or theme="amoled". Lighting rigs, environment reflections, blending modes and canvas backgrounds change with it — AMOLED uses true #000000 with controlled emissive accents; Light uses soft studio lighting with contact shadows. 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. Canvas resolution adapts through the adaptive DPR range of the active quality preset.
Accessibility notes
- — Carousels expose aria-roledescription and respond to arrow keys.
- — Images have alternative text; the lightbox traps focus and closes on Escape.
- — The before/after slider is a real range input.
Performance notes
- — Artwork is generated SVG textures — swap in your own optimised images.
- — WebGL galleries share one canvas and one texture per tile.
- — DOM galleries use compositor-only transforms.
Presets: LOW (DPR 1, no AA, ~35% density) · MEDIUM (DPR ≤1.5, ~70%) · HIGH (DPR ≤2, full density).