Scroll Sync Gallery
Full-width pinned image wall — four vertical columns travel at different speeds and alternating directions, all driven by one normalized scroll progress. Fully reversible, GPU-friendly, with responsive redistribution and reduced-motion fallback.
Installation#
pnpm dlx shadcn@latest add @davinciui/scroll-sync-galleryUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
columnsDesktop column definitions. Each entry has id, direction ('up' | 'down'), speed multiplier, offset phase shift (-0.5…0.5) and an images array of { src, alt, aspectRatio }. On smaller screens images redistribute round-robin into fewer columns. | ScrollSyncGalleryColumn[] | — |
presetMotion preset for columns without explicit config and for redistributed mobile/tablet columns. Alternating opposes neighbors, flow moves all up at varied speeds, mixed varies direction, speed and offset. | "alternating" | "flow" | "mixed" | "alternating" |
scrollHeightHeight of the tall scroll track in vh. The viewport stays pinned at viewportHeight while scrolling through it. | number | 400 |
viewportHeightHeight of the pinned viewport (any CSS length). | string | "100vh" |
gapHorizontal gap (px) between columns. | number | 0 |
rowGapVertical gap (px) between images inside a column. | number | 0 |
travelBase travel distance as a fraction of viewport height. Per-column travel = travel × speed, clamped to measured content headroom so no gaps ever appear. | number | 0.65 |
smoothingScroll-follow smoothing 0 (direct) to 1. Interpolates rendered progress toward actual scroll progress each frame for a weighted cinematic feel. | number | 0.12 |
objectFitHow images fill their frame. | "cover" | "contain" | "fill" | "cover" |
objectPositionImage focal point (CSS object-position). | string | "50% 50%" |
desktopColumnsColumn count on desktop. | number | 4 |
tabletColumnsColumn count below tabletBreakpoint. | number | 3 |
mobileColumnsColumn count below mobileBreakpoint. | number | 2 |
duplicateCountHow many times each column's image set repeats. Extra copies provide travel headroom so columns never expose empty background. | number | 2 |
introZoomSubtle scale-in of the whole wall during the first 12% of scroll progress so the gallery eases into view. | boolean | true |
enabledWhen false, renders a static accessible editorial grid instead of the pinned scroll effect. | boolean | true |
pauseWhenOffscreenPause transform work while the gallery is far offscreen (IntersectionObserver with 600px margin). | boolean | true |
Accessibility#
Images keep their alt text and the section is labelled, but repeated duplicate copies can expose the same alt text more than once to screen readers. The gallery is scroll-driven with no focusable controls; the disabled-animation fallback renders a static grid.
Motion#
Columns translate on the y axis from one normalized scroll progress with optional smoothing, and introZoom briefly scales the wall; presets and travel set directions and distance. A matchMedia check replaces the effect with a static grid for prefers-reduced-motion.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

