Gallery Rail

Swimmers seen from above near a rocky shoreline

Low tide

Chet Baker, 2023

A pebble beach curving along a turquoise bay

The long bay

Nina Simone, 2022

Swimmers in a narrow rocky bay below pine trees

Under the pines

Miles Davis, 2024

A deep turquoise inlet between two cliffs

Inlet

Joni Mitchell, 2024

A limestone cove with clear green water

Green water

Bill Evans, 2023

About this component

Gallery Rail

A horizontal gallery wall of photographs in frames of different proportions, hung on one eye line with a title and credit under each. Travel along the wall comes from a number or a live scroll value, or the wall drifts slowly on its own. Each photograph moves a little slower than its frame, and frames grow slightly as they reach the middle. Content such as a heading can hang first on the wall. Photographs load just before they arrive. Reduced motion turns the wall into a plain horizontal scroll.

Usage

The import and the props worth knowing about, in one place.

import { GalleryRail } from "@/components/beste/component/gallery-rail";

<GalleryRail
  className="h-[36rem]"
  items={[
    { src: "https://images.unsplash.com/photo-1579437469180-e31a7aa7273d?w=1400&q=80", alt: "A pebble beach", title: "The long bay", caption: "Nina Simone, 2022", aspect: 1.5 },
    { src: "https://images.unsplash.com/photo-1689202893906-7528e0e89379?w=1400&q=80", alt: "A rocky bay", title: "Under the pines", caption: "Miles Davis, 2024", aspect: 0.75 },
  ]}
/>

// Driven by scroll: pass a framer-motion MotionValue (or any { get() }) as progress
const { scrollYProgress } = useScroll({ target: ref, offset: ["start start", "end end"] });
<GalleryRail progress={scrollYProgress} autoplay={false} lead={<h2>Room 4</h2>} />

Props

Read from the component's own type, so this cannot drift from what it accepts.

PropTypeDefaultDescription
itemsGalleryRailItem[]—The photographs along the wall, in order.
leadReactNode—Content hung first on the wall, such as a heading and buttons.
gapnumber—Space between frames in pixels; narrow screens use less.
frameHeightnumber—Frame height as a share of the rail height, 0.3 to 0.8.
parallaxnumber—How much slower each photograph moves than its frame, 0 to 1.
liftnumber—How much a frame grows as it reaches the middle, 0 to 1.
shadowboolean—Soft cast shadow under each print.
progressnumber | GalleryRailProgressSource—Travel along the wall from start (0) to end (1): a number or a live source such as a scroll MotionValue.
autoplayboolean—Drift slowly along the wall and back on its own. Defaults to on when no progress is given.
speednumber—Pace of the autoplay drift.
pausedboolean—Stop the drift where it is.
classNamestring—

More Media components

View all Media
01

Listen first

Every project opens with a week of questions and no drawings at all.

02

Draw by hand

Early ideas stay on paper, where they are cheap to change.

03

Build a model

Card and timber models tell the truth about light and scale.

04

Make it real

The same small team stays with the work until the keys are handed over.

05

Come back

A visit a year later, to see how the place is being lived in.

A model in wide striped trousers leaning on a teal wallA glass perfume bottle casting amber shadows on warm paperA woman in a dark check coat walking down a city streetOrange poppies against a clear blue skyA singer with one hand raised in stage smoke and red light
A model in a bright yellow fleece set on a concrete courtA red swing carousel spinning against a pale skyA woman with short hair looking back over her shoulderA dropper bottle of golden oil on a round wooden boardA model in a red jersey and black jacket against a teal sky

Built around the light.

Curved white bands of a building rising around an opening of blue sky