Horizontal Rail
Move a row of cards sideways as the page scrolls. A native horizontal scroller is available as a fallback.
- Dependencies
- gsap
- Size
- 303 lines
- Controls
- 9 controls
Installation
CLI · shadcn registry
npx shadcn@latest add https://ui.onycx.dev/r/horizontal-rail.json1 · Dependencies
npm install gsap2 · Copy the source
components/onycx/horizontal-rail.tsx
Requires React 19 and Tailwind CSS v4. Copy the source from the horizontal-rail.tsx tab after tweaking: your values are baked in as the new defaults. Exported image examples use portable sample artwork. Replace it with your own media as needed.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items | RailItem[] | — | { title, family?, tagline?, image, imageAlt?, href? }. Cards become links when href is set. |
| index / eyebrow | string | "II" / "The Signatures" | Caps label with a gold rule. |
| heading / headingAccent | string | "A feeling," / "before a name." | Serif heading with a gold italic tail. |
| intro | string | — | Header paragraph; "\n" breaks a line. |
| hint | string | "Scroll through the collection" | Caps label under the rail. Empty hides it. |
| offset / scrub | number | 0 / 0.8 | Pin position below a fixed header (px) and scroll smoothing. |
| turn | boolean | false | Adds the per-card 3D turn while pinned. |
| gold / ivory / background | string | "#c8ae80" / "#f3ebdd" / "#0e0d0c" | Accent, text and section colours. |
| className | string | — | Extra classes on the section. |