UniqueUI

Horizontal Scroll Gallery

Converts vertical scroll into horizontal movement with momentum physics for immersive galleries.

npx uniqueui add horizontal-scroll-gallery

Preview

Landscape 1
Landscape 2
Landscape 3

End of Gallery

Usage

import { HorizontalScrollGallery } from "@/components/ui/horizontal-scroll-gallery";

export default function Example() {
  const images = [
    <img key="1" src="https://images.unsplash.com/photo-1682687982501-1e58f8108c6b" alt="Landscape 1" className="object-cover w-full h-full" />,
    <img key="2" src="https://images.unsplash.com/photo-1682687220063-4742bd7fd538" alt="Landscape 2" className="object-cover w-full h-full" />,
    <img key="3" src="https://images.unsplash.com/photo-1682687981922-7b55dbb3086b" alt="Landscape 3" className="object-cover w-full h-full" />,
    <div key="4" className="w-full h-full bg-neutral-900 flex items-center justify-center p-8 text-center text-white">
      <h3 className="text-4xl font-bold">End of Gallery</h3>
    </div>
  ];
  return (
    <HorizontalScrollGallery items={images} />
  );
}

Props

PropTypeDescription
itemsReact.ReactNode[]Array of React nodes (e.g. images, cards) to map across the horizontal track.
direction"left" | "right"Direction the track moves when the user scrolls down.
itemClassNamestringCommon classes applied to every individual container.