Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
React Intersection Observer | 4,339 | 153 | 590 | 12 days ago | 144 | June 28, 2023 | mit | TypeScript | ||
React implementation of the Intersection Observer API to tell you when an element enters or leaves the viewport. | ||||||||||
Blog | 3,329 | 4 years ago | 65 | mit | JavaScript | |||||
:dog: :clap: :star2: Welcome to star | ||||||||||
React Visibility Sensor | 2,198 | 477 | 351 | 2 years ago | 53 | July 25, 2019 | 77 | mit | JavaScript | |
Sensor component for React that notifies you when it goes in or out of the window viewport. | ||||||||||
React Mapbox Gl | 1,839 | 317 | 63 | 5 days ago | 142 | November 26, 2020 | 264 | mit | TypeScript | |
A React binding of mapbox-gl-js | ||||||||||
React Cool Inview | 1,454 | 13 | 2 months ago | 86 | April 17, 2022 | 18 | mit | TypeScript | ||
😎 🖥️ React hook to monitor an element enters or leaves the viewport (or another element). | ||||||||||
React Stickynode | 1,183 | 142 | 62 | 11 days ago | 50 | July 15, 2022 | 16 | other | JavaScript | |
A performant and comprehensive React sticky component. | ||||||||||
React Spaces | 1,139 | 4 | 8 | 4 months ago | 83 | August 30, 2023 | 15 | mit | TypeScript | |
React components that allow you to divide a page or container into nestable anchored, scrollable and resizable spaces. | ||||||||||
Fresnel | 1,119 | 2 | 26 | a month ago | 63 | August 29, 2023 | 28 | other | TypeScript | |
An SSR compatible approach to CSS media query based responsive layouts for React. | ||||||||||
React Intersection Observer | 1,090 | 65 | 67 | 7 months ago | 34 | November 04, 2020 | 18 | mit | JavaScript | |
React component for the Intersection <Observer /> API | ||||||||||
React Awesome Reveal | 954 | 1 | 13 | 2 months ago | 62 | June 29, 2023 | 18 | mit | TypeScript | |
React components to add reveal animations using the Intersection Observer API and CSS Animations. |
A set of low level utility components for react to make working with the viewport (e.g scroll position or size of the page) easy to use and performant by default.
See the example folder for more information about what you can build with it.
On a website with more sophisticated user interactions a lot of components need access to viewport information to e.g. know whether they are in the viewport, should resize or trigger an animation.
Most of the libraries reimplement the required functionality for that kind of features on its own over and over again. Those functionalities are not just hard to implement but can also, if not done well, cause the UX to suffer by introducing layout thrashing and therefore jank and will also cause the bundle size to grow which reduce the time to interaction. Further its hard to prioritize between highly and less important events if the implementation is not bundled in one central position.
This library solves all those issues by
onUpdate
callbacks, render props, higher order components and hooks which make the developer experience as simple as possible and allows the developer to concentrate on the application and not on global event handling.Please note that react
version 16.3 or higher is required for this library to work because it is using the context as well as references api.
npm install --save react-viewport-utils
By default the library ships with Typescript definitions, so there is no need to install a separate dependency. Typescript is no a requirement, all type definition are served within separate files.
For detection of some resize events the ResizeObserver
API is used internally which is not supported in some browsers. Please make sure to implement a polyfill on your own in case its required for your application.
The goal is to support the most recent versions of all major browsers (Edge, Safari, Chrome and Firefox).
We try to be downward compatible with older browsers when possible to at least not throw errors, but older versions will not be test at all.
In case you have specific requirements, please fill an issue or create a PR so we can discuss about them.
The project aims to support recent releases of v8 and v10 and higher of NodeJS.
ViewportProvider
ObserveViewport
connectViewport
useViewport
useMutableViewport
useScroll
useDimensions
useLayoutSnapshot
useViewportEffect
useScrollEffect
useDimensionsEffect
useRect
useRectEffect
Licensed under the MIT License.