Get Started
Svelte Lenis is a library that helps you smoothly scroll through your page. It's built on Lenis
Requirements
Supports projects created using Svelte 5.
Install
Install Svelte Lenis using your package manager of choice.pnpm add svelte-lenis
bun add svelte-lenis
npm install svelte-lenis
Usage
<script>
import { SvelteLenis } from 'svelte-lenis'
</script>
<SvelteLenis root>
<!-- content -->
</SvelteLenis>
Props
options
: Lenis options.root
: Lenis will be instanciate usinghtml
scroll. Default:false
.autoRaf
: Iffalse
,lenis.raf
needs to be called manually. Default:true
.rafPriority
: Tempus execution priority. Default:0
.class
: class name for the wrapper div. Default:undefined
.onSetup
: When Lenis setup is done, this callback will be called. Read OnSetup for more details.
OnSetup
type OnSetup = (value: {
lenis: Lenis;
wrapper?: HTMLDivElement;
content?: HTMLDivElement;
}) => void;
lenis
: The Lenis instancewrapper
: The wrapper div element, will only be defined ifroot
isfalse
.content
: The content div element, will only be defined ifroot
isfalse
.