Skip to content
New: Customize your theme with an AI assistant. Read the guide

Smooth Scroll

File: src/config/config.toml · Skill level: Beginner

Covena can make scrolling with a mouse wheel or trackpad glide instead of jumping line by line. It uses a small library called Lenis. It ships off, because it takes over the browser’s own scrolling, and many visitors prefer what they are used to.

Turn It On

src/config/config.toml
[effects]
smoothScroll = true

Even when it is on, smooth scroll stays out of the way:

  • Phones and tablets keep their normal touch scrolling, and don’t download Lenis at all.
  • Visitors who turn on reduce motion in their device settings keep the browser’s normal scrolling.

The scroll motion (reveals, pinned steps, stacked cards) works with or without it. See Animations.

Tune It

The feel is set under [settings.smoothScroll]. These values only matter while [effects] smoothScroll = true:

[settings.smoothScroll]
respectReducedMotion = true
duration = 1.1
easing = "expo"
smoothWheel = true
syncTouch = false
wheelMultiplier = 1
touchMultiplier = 1
anchors = true
autoRaf = true
stopInertiaOnNavigate = true
SettingWhat it does
respectReducedMotiontrue turns smooth scroll off for visitors who ask for reduced motion. Keep it on
durationHow long the glide lasts, in seconds. Higher feels slower and smoother
easingThe feel of the glide: expo, linear, easeOutQuad, or easeOutCubic
smoothWheelSmooths mouse wheel and trackpad scrolling
syncTouchApplies smoothing to touch input on devices that have both a mouse and a touchscreen
wheelMultiplierHow far one wheel movement scrolls. 1 is normal
touchMultiplierHow far one swipe scrolls when syncTouch is on. 1 is normal
anchorsGlides to #section links on the same page instead of jumping
autoRafLets Lenis run its own animation loop. Leave it on
stopInertiaOnNavigateStops any remaining glide when a visitor clicks a link

To change the feel, adjust duration first. Restart npm run dev if a change doesn’t show.

Keyboard Jumps

While smooth scroll runs, ⌘ + ↑ / ↓ on macOS, or Ctrl + Home / End on Windows, glides to the top or bottom of the page. [settings.keyboardScroll] turns this off (enable = false) or sets its duration in seconds.

For Developers

The Lenis instance is window.__themeLenis. It only exists while smooth scroll runs, so check for it first:

window.__themeLenis?.stop();
window.__themeLenis?.start();
window.__themeLenis?.scrollTo("#contact");

An element with its own scroll area should keep native scrolling. Add data-lenis-prevent to it:

<div class="overflow-y-auto" data-lenis-prevent>...</div>

The script is in src/layouts/components/global/GlobalScripts.astro.

Do It With AI

Turn on smooth scrolling in this Covena site and make it feel [SLOWER / FASTER].
In src/config/config.toml set smoothScroll = true under [effects], and change only
duration under [settings.smoothScroll]. Keep respectReducedMotion = true and don't
change any other key.
Type something to search...