🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

nuxt-lenis

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-lenis

This is a Nuxt wrapper for [Lenis](https://lenis.studiofreight.com/) by [Studio Freight](https://studiofreight.com/). Thank them for the incredible tool.

2.1.0
Source
npm
Version published
Weekly downloads
471
-13.89%
Maintainers
1
Weekly downloads
 
Created
Source

Nuxt Lenis

This is a Nuxt wrapper for Lenis by Studio Freight. Thank them for the incredible tool.

Please Note

Because of how Vue/Nuxt useState works, we have to recreate the ScrollState to a new object. We are porting over all fields we find necessary as you can also grab Lenis for all methods and attributes.

Getting Started

  • yarn add nuxt-lenis
  • Add nuxt-lenis to your modules in nuxt.config
  • In your app.vue file, wrap the nuxt page in the lenis component
       <lenis
          :options="LenisOptions"
          @initiated="foo"
          @scroll="fooBar"
       >
          <NuxtPage />
       </lenis>
    

Composable

   <!-- You can pass in true or false into useLenis if you want to use more than one lenis instance. Defaults to single instance (true) -->
   const {scrollState, lenis} = useLenis()

   watch(scrollState, (val) => {
      console.log("scrollState", val);
   },{deep:true});

Multiple Instances

If you have multiple instances of Lenis you can get each one via an ID set ont he Lenis component

   <lenis id="base" >
      <NuxtPage />
   </lenis>
   
   <lenis id="modal" >
      <NuxtPage />
   </lenis>

   <!-- script -->
   const {scrollState, lenis} = useLenis(false)

   scrollState.value.base
   lenis.base
   scrollState.value.modal
   lenis.modal

Keywords

nuxt

FAQs

Package last updated on 11 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts