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

react-use-scroll-snap

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-scroll-snap

A React Hook for JavaScript scroll snapping.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
563
increased by29.43%
Maintainers
1
Weekly downloads
 
Created
Source

react-use-scroll-snap

A minimal React Hook for JavaScript scroll snapping. The Hook primarily snaps to elements using the wheel and touchmove events. Please reference the example folder on how to use the Hook.

API

Properties

PropertyTypeDefaultDescriptionRequired
refReact.RefObject<HTMLElement>N/AParent element of the scroll items.Yes
durationnumber100Snap animation length in miliseconds.No
isArrowKeysEnabledbooleanTrueEnables the up and down arrow keys for snapping.No
isDirectionEnabledbooleanTruePrioritizes scroll direction over element visibility in the viewport.No

Return Object

PropertyTypeDescription
stateReact.RefObject<ScrollState>The internal state object used to track scroll information.
goto(index: number) => voidA function that will scroll to the element at the specified index.

Installation

The package can be installed using npm. The package is written in TypeScript and exports the type declaration file in the distribution.

npm install react-use-scroll-snap

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

FAQs

Package last updated on 19 Aug 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