Smooth Scroll
@sushindustries/uiMounts Lenis for the page and renders nothing. Respects reduced motion.
SmoothScroll mounts Lenis for the whole document and renders nothing itself -
what changes is how the page feels under the wheel, easing instead of jumping
frame to frame. Mount it once near the root; anyone with reduced motion set
gets the browser's own scroll instead, which is correct for them.
tanstacktanstack add https://adamjurek.com/r/tanstack/smooth-scroll.jsonpnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/smooth-scroll.jsonWhy it is built this way
It mounts inside an effect rather than at module scope, because Lenis
touches window and document immediately, and the root component that
renders it also renders on the server. Effects only run in the browser, so
the server render and the first client render both stay untouched, and Lenis
only takes over once there is an actual document for it to take over.
Install
tanstack add https://adamjurek.com/r/tanstack/smooth-scroll.jsonshell
pnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/smooth-scroll.jsonshell
pnpm add @sushindustries/ui @sushindustries/atomsshell
What you get
| Version | 0.1.0 |
| Category | motion · Scroll effects |
| Files | smooth-scroll.tsx |
| Dependencies | lenis@1.3.26 |
| Tags | scroll, lenis |