Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@studio-freight/react-lenis

Package Overview
Dependencies
Maintainers
4
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@studio-freight/react-lenis

[![Bibliotheca](https://assets.studiofreight.com/bibliotheca/header.png)](https://github.com/studio-freight/bibliotheca)

  • 0.0.11
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

Bibliotheca

Introduction

react-lenis creates and manages an instance of the Lenis. It takes in a root prop and an options object that is spread into the Lenis constructor.

If root is true, <ReactLenis> will be the root Lenis instance and all other <ReactLenis> components in the app will get the instance from the context. If root is false, the component will create a new Lenis instance and provide it via the context. It's recommended to only have one <ReactLenis root> component in your app.


Usage

const Layout = () => {
  return (
    <ReactLenis root options={{ ...options }}>
      {/* Your scrollable website */}
    </ReactLenis>
  )
}

Options

The options object is passed directly to the Lenis instance, check their readme for reference


Extras

Once the Lenis context is set (components mounted inside <ReactLenis>) you can use these handy hooks:

useLenis is a hook that returns the Lenis instance

The hook takes three argument:

  • callback: The function to be called whenever a scroll event is emitted
  • deps array: Trigger callback on change
  • priority: Manage callback execution order

Folder Structure

  • /bundled: Generated by microbundle after running build:bundled script. Includes all external dependencies.
  • /dist: Generated by microbundle after running build:dist script.
    • /dist/types Generated by tsc after running build:types script.
  • /docs: Used by vite through dev script to serve the documentation.
  • /docs/App.jsx: here's where you can test your library.
  • /src: Your library's raw code.

@studio-freight/react-lenis in use


Authors

This tool is maintained by the Studio Freight Darkroom team:


License

The MIT License.

FAQs

Package last updated on 20 Feb 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc