Horizontal Scroll

Pins a section and turns vertical scrolling into horizontal movement.

gsap@gsap/reactMIT · free

Scroll down: the row moves sideways →

Shore
Swell
Reef
Tide
Current
Deep

Installation

npx shadcn@latest add https://ombakui.com/r/horizontal-scroll.json

Usage

import { HorizontalScroll } from "@/components/horizontal-scroll";

<HorizontalScroll gap="1rem">
  {projects.map((p) => (
    <div key={p.id} className="h-[60vh] w-[480px] shrink-0">…</div>
  ))}
</HorizontalScroll>

Props

PropTypeDefaultDescription
children*ReactNode–The panels, laid out in a row.
gapstring"1.5rem"Space between panels, any CSS length.
disableBelownumber768Below this viewport width (px) it becomes a native swipe row.
scrubboolean | number1Scroll smoothing: true, or seconds of lag.
classNamestring–