Skip to content
Onycx-ui
ESC

Smooth Scroll

Set up Lenis once and share its scroll timing with GSAP ScrollTrigger.

Dependencies
lenis · gsap
Size
77 lines
Controls
4 controls

Installation

CLI · shadcn registry

npx shadcn@latest add https://ui.onycx.dev/r/smooth-scroll.json

1 · Dependencies

npm install lenis gsap

2 · Copy the source

components/onycx/smooth-scroll.tsx

Requires React 19 and Tailwind CSS v4. Copy the source from the smooth-scroll.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

PropTypeDefaultDescription
childrenReactNode—The page content that scrolls.
durationnumber1.05Seconds a wheel gesture takes to settle (the jewellery and spa sites used 1.15).
wheelMultipliernumber1Scales wheel delta.
anchorOffsetnumber-96Offset for same-page anchor jumps under a fixed header.
desktopOnlybooleantrueSmooth only at 1024px+ with hover and a fine pointer; false smooths every device without reduced motion.