Dome Gallery

A draggable 3D dome gallery — spin the image sphere and click a photo to enlarge it.

A draggable dome of images. Spin it with a drag, let go to keep it moving, and click any photo to bring it to the center.

Installation

Add the component with the Craft-UI Blocks CLI:

npx mvpblocks add dome-gallery
pnpm dlx mvpblocks add dome-gallery
yarn dlx mvpblocks add dome-gallery
bunx mvpblocks add dome-gallery

The component uses @use-gesture/react for drag handling. The CLI installs it for you; if you copy the source manually, add it yourself:

npm install @use-gesture/react
pnpm add @use-gesture/react
yarn add @use-gesture/react
bun add @use-gesture/react

File Structure

Import the default export from @/components/ui/dome-gallery.

Usage

DomeGallery is a client component. It fills its parent, so give the wrapper a height:

"use client";

import DomeGallery from "@/components/ui/dome-gallery";

export default function GalleryPage() {
  return (
    <div className="h-screen w-full">
      <DomeGallery
        images={[
          "https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?q=80&w=800",
          {
            src: "https://images.unsplash.com/photo-1470770841072-f978cf4d019e?q=80&w=800",
            alt: "Mountain lake at sunrise",
          },
        ]}
        fit={0.8}
        minRadius={600}
        segments={34}
        dragDampening={2}
        grayscale
      />
    </div>
  );
}

Each image can be a URL string or an object with src and alt. With no images prop the component renders its built-in demo set.

Props

Prop

Type

Registry Bundle

The registry entry includes dome-gallery.tsx and its runtime dependency @use-gesture/react (plus react).

Contact

If you find any bug or issue, feel free to raise an issue.

Last updated on