Lenis Grid Notes
Lightweight smooth-scroll engine that keeps native browser scrolling, sticky positioning and intersection observers intact, and pairs cleanly with GSAP ScrollTrigger.
Install and prerequisites
npm install lenislenisImport lenis/dist/lenis.css once in your root stylesheet or layout so stopped, smooth and nested-scroll containers get the required styles.
Framework setup
React and Next.js App Router with GSAP ticker
Drive Lenis from gsap.ticker with autoRaf: false so ScrollTrigger and smooth scrolling share one requestAnimationFrame loop.
"use client";
import { useEffect, useRef, type ReactNode } from "react";
import gsap from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { ReactLenis, type LenisRef } from "lenis/react";
import "lenis/dist/lenis.css";
gsap.registerPlugin(ScrollTrigger);
export function SmoothScroll({ children }: { children: ReactNode }) {
const lenisRef = useRef<LenisRef>(null);
useEffect(() => {
const update = (time: number) => {
lenisRef.current?.lenis?.raf(time * 1000);
};
gsap.ticker.add(update);
gsap.ticker.lagSmoothing(0);
return () => gsap.ticker.remove(update);
}, []);
return (
<ReactLenis
ref={lenisRef}
root
options={{ autoRaf: false, allowNestedScroll: true, anchors: true, stopInertiaOnNavigate: true }}
>
{children}
</ReactLenis>
);
}Scrollable inner panels and Firefox textareas
Mark custom overflow containers with data-lenis-prevent, and set textarea { overflow: auto } in CSS so Firefox nested scrolling works.
/* Firefox computes textarea overflow as "visible", which makes allowNestedScroll scroll the page instead. */
textarea {
overflow: auto;
}
/* Keep sticky header clearance on html rather than per-element scroll-mt-* classes. */
html {
scroll-padding-top: 5rem;
}Gotchas for agents
One ticker only
When pairing Lenis with GSAP ScrollTrigger, pass
autoRaf: falseto Lenis and multiply GSAP's seconds timestamp by1000insidegsap.ticker.add((time) => lenis.raf(time * 1000)). LeavingautoRaf: trueruns two competing RAF loops and causes jitter.Firefox textareas need explicit overflow
Firefox reports
getComputedStyle(textarea).overflowasvisible(Chromium reportsauto). Lenis'sallowNestedScrollchecks that computed value, so wheeling inside a<textarea>scrolls the page in Firefox unless your CSS setstextarea { overflow: auto }.Native scroll calls are ignored mid-glide
While Lenis is easing (
isScrollingis'smooth'), programmaticwindow.scrollTo()calls are overwritten on the next frame. Uselenis.scrollTo(target, { immediate: true })or enablestopInertiaOnNavigate: truefor route changes.Mount per route group, not inside heavy hydration
Keep
<ReactLenis root>out of routes that must not load scroll libraries, and passanchors: trueso hash links (#contentskip links included) scroll to their target while preserving focus.
Accessibility and reduced motion
Reduced motion
Lenis 1.3.26+ honours prefers-reduced-motion: reduce by default (respectReducedMotion: true), turning off scroll smoothing and making scrollTo jump immediately.
Keyboard and screen readers
Lenis's anchor click handler calls scrollTo without cancelling the native hash navigation, so <a href="#content"> skip links still move the sequential focus starting point.
export function SkipLink() {
return (
<a
href="#content"
className="sr-only focus:not-sr-only focus:fixed focus:top-3 focus:left-3 focus:z-50 focus:bg-background focus:px-4 focus:py-2"
>
Skip to content
</a>
);
}More Grid Notes
- GSAPTimeline, scroll-linked and text-splitting animation engine. All plugins — including ScrollTrigger, SplitText and MorphSVG — are included under Webflow's no-charge licence.
- MotionMIT-licensed animation library for React and JavaScript (formerly Framer Motion), offering a 3.3 kB `motion/mini` WAAPI build as well as layout, gesture and spring animations.
- dotLottieLottieFiles' WebAssembly-powered player for `.lottie` archives and Lottie JSON animations, with official wrappers for React, Vue, Svelte and plain web canvas.
- NumberFlowDependency-free animated number component for React, Vue and Svelte that rolls individual digits into place and formats values with `Intl.NumberFormat`.
- RiveInteractive state-machine graphics packaged in compact `.riv` files and driven at 60–120 fps by Rive's open-source WebGL2 and Canvas runtimes.
- Theatre.jsKeyframe timeline engine and visual studio overlay for choreographing Three.js / React Three Fiber cameras, lights and DOM properties.



