Smooth scroll as it should be

★ 17,175⑂ 784
TypeScriptCreated 2022-02-21lenis.dev
17,175
stars
+115+140+1,002
784
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions

README

Introduction

Lenis ("smooth" in latin) is a lightweight, robust, and performant smooth scroll library. It's designed by @darkroom.engineering to be simple to use and easy to integrate into your projects. It's built with performance in mind and is optimized for modern browsers. It's perfect for creating smooth scrolling experiences on your website such as WebGL scroll syncing, parallax effects, and much more, see Demo and Showcase.

Read our Manifesto to learn more about the inspiration behind Lenis.



- Features
- Sponsors
- Packages
- Showcase
- Installation
- Setup
- No-code usage
- Settings
- Properties
- Methods
- Events
- Considerations
- Limitations
- Troubleshooting
- Tutorials
- Plugins
- License



 Features

- Lightweight & dependency-free — the whole library is a few KB with zero runtime dependencies
- Runs on native scroll — wraps the browser's own scroll, so position: sticky, anchor links, and accessibility keep working
- Any axis — smooth vertical, horizontal, and nested scrolling from a single instance
- Built for sync — drives WebGL scroll scenes, GSAP ScrollTrigger, and parallax off one loop
- Framework adapters — first-class packages for React, Vue, and Framer
- Scroll snapping — the snap plugin aligns sections without fighting the smooth scroll

 Sponsors

If you’ve used Lenis and it made your site feel just a little more alive, consider sponsoring.

Your support helps us smooth out the internet one library at a time—and lets us keep building tools that care about the details most folks overlook.




       




 Packages

- lenis
- lenis/react
- lenis/vue
- lenis/framer
- lenis/snap



 Installation

Using a package manager:

bash
npm i lenis
 or
yarn add lenis
 or
pnpm add lenis


js
import Lenis from 'lenis'




Using scripts:

html
 





 Setup

 Basic:

js
// Initialize Lenis
const lenis = new Lenis({
  autoRaf: true,
});

// Listen for the scroll event and log the event data
lenis.on('scroll', (e) = {
  console.log(e);
});


 Custom raf loop:

js
// Initialize Lenis
const lenis = new Lenis();

// Use requestAnimationFrame to continuously update the scroll
function raf(time) {
  lenis.raf(time);
  requestAnimationFrame(raf);
}

requestAnimationFrame(raf);


 Recommended CSS:

Import stylesheet:
js
import 'lenis/dist/lenis.css'


Or link the CSS file:

html



Or add it manually:

See lenis.css stylesheet

 GSAP ScrollTrigger:
js
// Initialize a new Lenis instance for smooth scrolling
const lenis = new Lenis();

// Synchronize Lenis scrolling with GSAP's ScrollTrigger plugin
lenis.on('scroll', ScrollTrigger.update);

// Add Lenis's requestAnimationFrame (raf) method to GSAP's ticker
// This ensures Lenis's smooth scroll animation updates on each GSAP tick
gsap.ticker.add((time) = {
  lenis.raf(time  1000); // Convert time from seconds to milliseconds
});

// Disable lag smoothing in GSAP to prevent any delay in scroll animations
gsap.ticker.lagSmoothing(0);





 No-code usage

One line, no build step — just drop this in

Snapshot: 2026-11-10T09:35:25Z · Data license Apache-2.0 · JSON