How Lenis Smooth Scroll Works With the Browser

Learn how Lenis smooths wheel input while preserving real browser scroll positions, plus the React, performance, and accessibility trade-offs.

lenis smooth scroll cover image
Vidushi Saxena

Vidushi Saxena

Developer

Read Time: 11 mins

Category: Engineering

Share this Article:

Lenis smooth scroll does not need to fake an entire scrolling page. For the input it smooths, Lenis takes the requested movement, establishes a target scroll position, interpolates toward that target over animation frames, and updates the browser’s real scroll coordinates as it goes. Unlike transform-based scrolling implementations, where a wrapper can visually move while the browser’s scroll state tells a different story, Lenis continues advancing actual scroll coordinates.

Its current source tracks values including targetScroll, animatedScroll, and the actual browser scroll position, then writes interpolated movement back to real scrolling coordinates. When native movement occurs outside the active smoothing path, Lenis can synchronize its internal state back to the browser’s actual position. See the official Lenis source and README.

That makes Lenis useful for creative frontend work where scroll pacing itself is authored: scroll-led storytelling, synchronized DOM and WebGL scenes, pinned sequences, or interactions where several animation systems need to agree about where the page is. It does not make Lenis the correct default for every website.

Lenis changes how you travel between scroll positions. The browser still owns a real scroll position.


Lenis Smooth Scroll in One Sentence

Lenis smooths the path toward a target scroll position while continuing to move the browser’s actual scroll position. A useful mental model is:

JSX
Wheel input    ↓Input handling / normalized delta    ↓targetScroll    ↓Interpolation in requestAnimationFrame    ↓animatedScroll    ↓Browser scroll position    ↓Scroll-linked consumers

The important distinction is between input handling and scroll state. A wheel gesture is not itself a scroll coordinate. Lenis can modify how that gesture becomes movement without replacing the browser’s document position with a purely visual transform.

There is also a native synchronization path:

JSX
Native browser scroll    ↓Browser scroll position changes    ↓scroll event    ↓Lenis synchronizes its internal state

The exact route depends on Lenis state and configuration. Its source only adopts native movement in the relevant native or non-smoothing states rather than treating every incoming scroll event identically. You can inspect that behavior in the Lenis core implementation.


Native Scrolling Has More Than One Layer

A wheel event, a browser scroll position, and a scroll-linked animation are related systems. They are not synonyms. Users can move through a document with a mouse wheel, trackpad, keyboard, scrollbar, anchor link, focus change, touch gesture, or programmatic scrolling API. A wheel event can also occur without producing useful page movement at all.

native scrolling

The browser’s scroll coordinates sit downstream from those inputs. This is why CSS scroll-behavior: smooth is not a drop-in substitute for Lenis- and why it is often the better answer when its narrower job is all you need. MDN defines scroll-behavior as controlling scrolling triggered by navigation and CSSOM scrolling APIs. Ordinary user scrolling is not affected by that property. See MDN’s scroll-behavior reference.

JSX
html {  scroll-behavior: smooth;}

That can make an anchor jump or scrollTo() call less abrupt. It does not turn every incoming wheel delta into an authored interpolation loop. For a documentation page where the requirement is simply “move to the selected section smoothly,” native CSS may be enough. For a campaign page where scrolling controls typography, pinned content, a WebGL camera, and multiple timelines, the character of movement between positions can become part of the composition. Those are different engineering jobs.


What Lenis Actually Does When You Scroll

The current Lenis implementation maintains separate concepts for where scrolling is heading and where the animated position currently sits. For a smoothed wheel path, incoming movement contributes to a target. Lenis then animates from its current animated position toward that target using its configured interpolation or duration/easing behavior. During that animation, it updates the actual browser scrolling position. When Lenis accepts a native scroll, its animated and target states can synchronize back to the actual position.

In deliberately simplified pseudocode:

JSX
onWheel(delta) {  targetScroll += normalize(delta)} onAnimationFrame(time) {  animatedScroll = interpolate(    animatedScroll,    targetScroll,    time  )   setBrowserScroll(animatedScroll)}

The production implementation does considerably more. It has to account for velocity, dimensions, limits, input handling, wheel and touch behavior, resize handling, programmatic scrolling, reduced-motion state, and nested scroll rules. The simplified model is useful because it exposes the architecture without pretending to reproduce every branch of the real implementation.

Target Scroll vs Animated Scroll

Imagine a wheel gesture has asked a default window-based vertical scroller to continue another few hundred pixels. The following numbers are illustrative, not measurements from a running Lenis instance:

JSX
Frame AtargetScroll:   1960animatedScroll: 1420window.scrollY: 1420 Frame BtargetScroll:   1960animatedScroll: 1588window.scrollY: 1588 Frame CtargetScroll:   1960animatedScroll: 1729window.scrollY: 1729

The target can remain ahead while the animated position approaches it. Because Lenis applies that animated position to the configured scroller, the browser’s real scroll position advances rather than remaining fixed while a wrapper merely translates on screen.

Inspect the Scroll State Instead of Taking the Diagram on Faith

You can make the relationship observable in a development build. Lenis scroll callbacks expose state such as targetScroll, animatedScroll, actualScroll, and velocity. For a normal document-level vertical scroller, comparing those values with window.scrollY makes the mechanism easier to inspect.

Do not log every scroll callback unconditionally. Console work - especially with DevTools open - can affect main-thread scheduling and distort the interaction you are trying to understand.

A development-only sampled inspector:

JSX
import type Lenis from 'lenis' function attachScrollInspector(lenis: Lenis): () => void {  let lastLog = 0   const unsubscribe = lenis.on('scroll', (state) => {    const now = performance.now()     if (now - lastLog < 100) return    lastLog = now     console.table({      targetScroll: Math.round(state.targetScroll),      animatedScroll: Math.round(state.animatedScroll),      actualScroll: Math.round(state.actualScroll),      browserScrollY: Math.round(window.scrollY),      velocity: Number(state.velocity.toFixed(2)),    })  })   return unsubscribe} const detachInspector = attachScrollInspector(lenis) // Later:// detachInspector()

actualScroll is the more portable Lenis-level diagnostic when a project uses a custom scroll wrapper or orientation. window.scrollY is specifically useful for the common document-level vertical case. Rounding also means tiny differences can disappear in the output, so treat the inspector as a way to understand the relationship between values rather than proof that they must always be numerically identical.

The lifecycle matters too. attachScrollInspector() returns Lenis’s unsubscribe function, so the listener remains active until the caller deliberately invokes detachInspector().

Use the diagnostic while scrolling slowly, then give the wheel a sharper input. During active smoothing, the target can move ahead while the animated and actual positions follow it.

JSX
LENIS SCROLL INSPECTOR Target        1960pxAnimated      1615pxActual        1615pxBrowser Y     1615pxVelocity      14.8

The inspector is for understanding and debugging state. Disable diagnostic logging before measuring long tasks, frame delivery, rendering cost, or interaction performance.


The RAF Loop Is the Smoothing Layer

Interpolation needs a frame loop. Current Lenis supports both an automatically managed RAF loop with autoRaf: true and a custom loop where the application calls lenis.raf(time) itself. Both approaches are documented in the official Lenis README.

The distinction matters when Lenis shares a page with another animation system. Several requestAnimationFrame callbacks do not automatically mean several browser rendering passes, but independent perpetual loops can duplicate JavaScript work, keep otherwise unnecessary rendering active, and cause systems to sample scroll state at different moments in the same frame.

Motion’s Lenis integration provides a concrete example. It recommends driving Lenis in Motion’s frame.setup phase when they share the same loop. That phase runs before Motion reads scroll state, so Lenis can write the new position before Motion measures it for scroll-linked work. See Motion’s Lenis integration guide.

Write the new scroll position before the animation system reads it.


What “Runs on Native Scroll” Does and Does Not Mean

Lenis moving the real scroll position has useful consequences. Motion’s integration documentation notes that Lenis changes the native position, allowing mechanisms such as Motion scroll() and useScroll to consume that position normally. It also makes the architecture fundamentally different from a page whose apparent movement comes only from translating a visual wrapper.

But “native scroll position” should not be stretched into “everything remains browser-native.” For wheel events that Lenis is smoothing, JavaScript is part of the interaction. Current Lenis documentation lists smoothWheel as enabled by default, while syncTouch defaults to false; touch should therefore not be described as identical to desktop wheel smoothing unless a project deliberately enables and tests that behavior.

ConcernNative browser scrollingLenis smoothing
Browser has a real scroll positionYesYes
Wheel movement can stay entirely browser-drivenYesNo while Lenis smooths that path
Authored interpolation between positionsNoYes
JavaScript required for smoothingNoYes
Scroll-linked consumers can observe real positionYesYes
Touch necessarily uses the same smoothing modelNoNo
CSS scroll-behavior requiredOptionalSeparate concern

Preserving real scroll coordinates also does not mean every browser behavior needs zero configuration. Anchors are an obvious example.


Current Lenis documentation does not enable Lenis anchor-link handling by default. The documented anchors option defaults to false, and the README states that anchor links are prevented while Lenis is scrolling unless anchor support is enabled.

For ordinary document anchors on a Lenis-controlled page, enable them deliberately:

JSX
const lenis = new Lenis({  autoRaf: true,  anchors: true,})

Lenis can also accept anchor-specific scroll options:

JSX
const lenis = new Lenis({  autoRaf: true,  anchors: {    offset: 96,  },})

The 96 value is illustrative. An offset can be useful when a sticky navigation bar would otherwise cover the destination heading.

Real browser coordinates do not remove integration responsibilities. Hash navigation, focus movement, browser back and forward behavior, routing, and sticky layouts still need to be tested as complete interactions.


The Performance Trade-Off: Smoother Coordination Costs Main-Thread Work

Do not read “smooth scroll” as “more performant scroll.” Lenis moves its smoothed wheel path into JavaScript work on the main thread. Motion’s integration documentation describes the consequence: native browser scrolling can continue on the compositor while JavaScript is busy, whereas a sufficiently long main-thread task can pause Lenis-driven scrolling and the animations tied to it. See Motion’s Lenis documentation.

performance trade off

The reason Lenis can still make sense on animation-heavy pages is coordination. If a narrative depends on DOM movement, JavaScript timelines, and WebGL state agreeing about scroll progress, controlling the movement can be worth that cost. Scroll coordination does not, however, reduce the rendering cost of everything else on the page. Continuous Three.js rendering, high device-pixel-ratio canvases, large textures, repeated layout measurements, oversized DOM trees, uncontrolled observers, listeners, and duplicate animation work all accumulate.

A Practical Performance Comparison

  1. Disable the scroll-state diagnostic and other development logging.
  2. Open a production build.
  3. Record a representative scroll interaction in browser DevTools.
  4. Repeat the same interaction with Lenis disabled.
  5. Look for long tasks and delayed frame delivery.
  6. Identify whether the expensive work is Lenis itself, a scroll callback, layout measurement, rendering, or another animation system.
  7. Repeat on the mobile hardware you actually support.

Also test during expensive moments: route transitions, image decoding, menu opening, canvas initialization, or other application work. A smoother that feels excellent on an idle page can expose its main-thread dependency once the rest of the application becomes busy.

The gain is control. The cost is responsibility.


Lenis and Scroll-Linked Animations

Because Lenis updates actual scroll coordinates, systems that consume those coordinates can respond to its interpolated movement. That might include a progress indicator, GSAP ScrollTrigger, Motion scroll() or useScroll, a canvas or WebGL renderer, or a native scroll-driven animation.

That does not mean Lenis is required for scroll-driven animation. Reading the same coordinates also does not guarantee correct frame synchronization; systems that share a frame-dependent interaction still need sensible scheduling.

Native Scroll-Driven Animations Have Changed the Decision

MDN currently marks ScrollTimeline as Baseline 2026, newly available across the latest devices and browser versions since October 2026. MDN also cautions that older devices or browser versions may not support it, so “Baseline” should not be interpreted as universal compatibility with every browser version still in use. See MDN’s ScrollTimeline reference.

ScrollTimeline and Lenis solve different problems. A scroll timeline answers: How should an animation progress as a scroller progresses? Lenis answers something closer to: How should particular user input move toward the next scroll position?

A simple reveal can therefore be native on a project that never installs Lenis. A complex authored scroll experience can use both. A content page may need neither. Use native scroll timelines when they express the required relationship without introducing another controller.


Production Details That Break Bad Smooth-Scroll Implementations

A convincing scroll demo can still fail when it meets a production layout. Real implementations have to survive modals, nested overflow, anchors, touch, keyboard interaction, reduced-motion preferences, route changes, late-loading media, and teardown. This is where scroll engineering stops being an easing discussion.

Nested Scroll Areas

A modal body, code panel, or overflow list may need to scroll independently of the page. Current Lenis provides several ways to keep those surfaces native. allowNestedScroll: true automatically detects nested scrollable elements, though the project documentation warns that this can carry a performance cost. More selective options include data-lenis-prevent, input-specific variants, and the prevent callback.

A straightforward modal:

JSX
<div className="modal">  <header>Keyboard shortcuts</header>   <div className="modal__body" data-lenis-prevent>    {/* independently scrollable content */}  </div></div>

You can narrow the exclusion when appropriate:

JSX
<div data-lenis-prevent-wheel>  ...</div>

The excluded surface still needs to be genuinely scrollable; adding an attribute does not create an overflow region by itself.

The surface under the user’s pointer or finger should own the movement it visibly promises.

Reduced Motion: Current Lenis Behavior

Recent Lenis versions include respectReducedMotion, with Motion documenting the default reduced-motion behavior from Lenis 1.3.26 onward. When prefers-reduced-motion: reduce applies, interpolation is disabled and programmatic scrolling becomes immediate while Lenis can remain active to synchronize its state.

That distinction matters. Disabling interpolation through Lenis’s reduced-motion handling is not necessarily equivalent to removing Lenis and handing all wheel processing back to the browser’s compositor.

The library also exposes lenis.prefersReducedMotion for application-level behavior. The exact behavior should still be checked against the package version your project ships.

JSX
if (lenis.prefersReducedMotion) {  // Prefer a stable state or immediate transition.}

This gives you a useful baseline. A page can remove scroll interpolation and still contain aggressive parallax, pinned motion, text distortion, autoplaying WebGL sequences, or focus states that appear inside moving content. Semantics, keyboard access, focus order, readable fallbacks, and appropriate input behavior remain separate responsibilities.

Mobile and Touch Are Not Desktop Wheel With Smaller Pixels

Current Lenis defaults make an important distinction: smoothWheel is enabled by default, while syncTouch is disabled by default. Lenis documents syncTouch as an optional mode for mimicking touch-device scrolling while keeping state synchronized, with a warning about instability on iOS versions below 16.

Do not copy desktop interpolation values onto touch merely because the project wants visual consistency. Test native touch first, then enable additional touch behavior only when the interaction has a concrete reason for it and the supported device matrix survives the decision.

At minimum, test slow drags, fast flicks, direction changes, nested scrolling, browser chrome changes, orientation changes, and touch interaction while expensive rendering work is active.

Know the Documented Limits

Current Lenis documentation also calls out limitations worth checking before the interaction architecture hardens. Native CSS scroll snap is not supported by the smoothing model, and Lenis points developers toward its snap integration instead. Smooth scrolling can also stop while the pointer is over an iframe because the parent page does not receive the same wheel input from inside that frame. Nested scrollers require deliberate configuration.

Check these details against the Lenis version and configuration you actually ship. They matter much more after a concept demo becomes a real page.


React and Next.js: Put Lenis at the Scrolling Boundary

For a page-level Lenis setup in React or Next.js, keep browser-dependent initialization inside a client boundary and mount one controller at the level that genuinely owns the page scroll.

In a Next.js App Router project, that might be a client component rendered from the layout that owns the marketing experience rather than a controller instantiated independently inside every animated section. If Lenis does not need to share another library’s frame loop, current Lenis supports the simpler autoRaf: true setup. Its recommended stylesheet should also be imported once.

A minimal strict-TypeScript client boundary:

JSX
'use client' import type { ReactNode } from 'react'import { useEffect } from 'react'import Lenis from 'lenis'import 'lenis/dist/lenis.css' type SmoothScrollBoundaryProps = {  children: ReactNode} export function SmoothScrollBoundary({  children,}: SmoothScrollBoundaryProps) {  useEffect(() => {    const lenis = new Lenis({      autoRaf: true,      anchors: true,    })     return () => {      lenis.destroy()    }  }, [])   return children}

This version has one clear owner: Lenis runs its own RAF, and the React boundary destroys the instance when that owner disappears. If the application already has a shared animation loop, do not blindly add another one. Set autoRaf: false and drive lenis.raf() from that existing scheduler. Motion’s official integration, for example, runs Lenis in frame.setup so the scroll position is written before Motion reads it later in the same frame.

A persistent Next.js layout adds another consideration: route navigation does not necessarily unmount the boundary, so cleanup alone is not a route-change strategy. Test navigation while Lenis still has momentum, browser back and forward behavior, hash navigation, route scroll restoration, persistent layouts containing multiple scroll-led pages, and any external scheduler that continues running across transitions.

Do not apply a universal route-reset recipe without testing it against the Lenis and Next.js versions your project actually uses.

Initialize Lenis at the boundary that owns page scrolling.

A Debugging Checklist for React and Next.js

When a Lenis integration behaves strangely, check the plumbing before adjusting easing values:

JSX
□ Is there exactly one page-level Lenis instance?□ Is autoRaf enabled, or is lenis.raf() actually being called?□ Is another animation library also trying to own frame timing?□ Is an external scheduler still active after navigation?□ Is lenis/dist/lenis.css imported once?□ Are anchors enabled if the page uses hash navigation?□ Do nested overflow areas opt out where needed?□ Is the controller destroyed when its React boundary actually unmounts?□ Does a persistent layout keep Lenis alive across route changes?□ Did late-loading fonts or images change measured layout?□ Does the same problem exist with Lenis disabled?□ Have keyboard, focus, back/forward, and reduced-motion paths been tested?

Before changing easing settings, check whether multiple systems are fighting over the scroll lifecycle.


When Native Browser Scrolling Is the Better Engineering Choice

Most websites do not need Lenis. Use native scrolling when movement itself is not part of the interaction design. Documentation, forms, account surfaces, dashboards, ecommerce flows, search-heavy interfaces, and long editorial pages often benefit more from directness than from authored damping.

Use CSS scroll-behavior when the actual job is smoothing navigation or API-triggered scroll movement. Use native scroll timelines when the platform can express the visual relationship you need without another runtime controller - and verify support against the browsers your project actually targets.

native browser scrolling

Consider Lenis when scroll character has a concrete job: coordinating animation systems, pacing a narrative, aligning DOM movement with WebGL, or shaping a scroll-led composition whose interpolation is intentionally part of the experience.

RequirementStart with
Ordinary content browsingNative scrolling
Smooth anchor/API navigationCSS scroll-behavior
Simple supported scroll-linked animationNative scroll-driven animation
Authored wheel interpolationLenis
Coordinated DOM + JS/WebGL scroll choreographyLenis may be useful
Utility-heavy UINative scrolling
Motion added only to make a site “feel premium”Revisit the interaction

Scroll smoothing has a high bar because it sits underneath one of the browser’s most fundamental interactions.

If scroll movement is part of your page’s composition, explore Vault Scroll Effects for React and Next.js. Choose the interaction first, then decide whether its scroll behavior actually needs Lenis.

tags:LenisSmooth ScrollingReactNext.jsScroll Animation