Skip to content

theo-js/react-use-section-observer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-use-section-observer

A lightweight React hook to track element visibility using the Intersection Observer API and automatically apply an active class to matching links.


🎥 Demo

Preview


✨ Features

  • Tracks visibility of multiple sections
  • Automatically updates matching anchor links
  • Supports custom root containers
  • Supports multiple class names (e.g. Tailwind)
  • No DOM mutation via data-*
  • No external dependencies
  • Fully typed (TypeScript)
  • Adjustable to your DOM structure

⚠️ Limitations

  • Only vertical scrolling (Y-axis) is supported.
  • Requires browser support for IntersectionObserver.

📦 Installation

npm install react-use-section-observer

About

A React hook to track element visibility using the Intersection Observer API and automatically apply an active class to matching links.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors