✋ Lenis smooth scroll directive for Vue templates
Install the library
pnpm add vue-lenis
Add the plugin to your Vue app:
import lenis from "vue-lenis";
createApp(App)
.use(lenis)
.mount("#app");
Just specify v-lenis
directive on a scrollable element and it's done!
<template lang="pug">
.view(v-lenis)
.content
// ...
</template>
Optionally you can provide an object with fields for the value:
ref
- Vue ref which will be assigned a lenis instance, available inonMounted()
hookregisterRaf
- If you want to run lenis.raf() by yourself, set it tofalse
. (Default:true
)settings
- Object with lenis instance settings