Gathering detailed insights and metrics for react-hover-observer
Gathering detailed insights and metrics for react-hover-observer
Gathering detailed insights and metrics for react-hover-observer
Gathering detailed insights and metrics for react-hover-observer
A React component that notifies its children of hover interactions
npm install react-hover-observer
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
55 Stars
40 Commits
15 Forks
4 Watchers
1 Branches
2 Contributors
Updated on Jan 19, 2025
Minified
Minified + Gzipped
Latest Version
2.1.1
Package Id
react-hover-observer@2.1.1
Size
8.09 kB
NPM Version
6.4.1
Node Version
9.10.0
Published on
Sep 08, 2018
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
1
27
A React component that notifies its children of hover interactions.
Optionally observe mouseenter, mouseleave, mouseover, and mouseout events.
Supports delayed hover and hover-off, which can help reduce unintentional triggering.
Experiment with these editable examples on CodePen.
For mouse or touch position monitoring, please consider react-cursor-position.
1npm install --save react-hover-observer
1import ReactHoverObserver from 'react-hover-observer'; 2 3export default () => ( 4 <ReactHoverObserver> 5 <YourChildComponent /> 6 </ReactHoverObserver> 7);
Each child component of ReactHoverObserver receives a Boolean prop named isHovering
.
react-hover-observer wraps its children in a div, which is the boundary for triggering hover events.
Optionally implement the function as child component pattern. This is especially useful if your component has an incompatible interface with react-hover-observer.
1export default () => ( 2 <ReactHoverObserver> 3 {({ isHovering }) => ( 4 <YourChildComponent isActive={isHovering} /> 5 )} 6 </ReactHoverObserver> 7);
className
: String [optional] - A CSS class to be applied to the div rendered by react-hover-observer.
hoverDelayInMs
: Number [optional] - Milliseconds to delay hover trigger. Defaults to zero. See the hoverDelayInMs example for more.
hoverOffDelayInMs
: Number [optional] - Milliseconds to delay hover-off trigger. Defaults to zero.
onHoverChanged
: Function [optional] - Called with named argument isHovering
when isHovering is set or unset. See the onHoverChanged example for more.
shouldDecorateChildren
: Boolean [optional] - Defaults to true. Optionally suppress decoration of child components by setting this prop false.
onMouseEnter
: Function [optional] - Defaults to set isHovering.
onMouseLeave
: Function [optional] - Defaults to unsetting isHovering.
onMouseOver
: Function [optional] - See the onMouseOver example for more.
onMouseOut
: Function [optional]
Each of the previous four observer functions receives a prameter of type Object with the following properties:
e
: Object - The browser event object (React synthetic event).
setIsHovering
: Function - Call this function to set isHovering
to true.
unsetIsHovering
: Function - Call this function to set isHovering
to false.
onMouseOver
and onMouseOut
can be used to control hover state when child components are hovered. See the onMouseOver example for more.
onMouseEnter
and onMouseLeave
are not triggered by hover events bubbling up from child elements.
onMouseOver
and onMouseOut
are triggered by hover events bubbling up from child elements.
The behavior is determined by mouse event Web standards. See the docs at MDN for more.
Please open an issue.
1git clone https://github.com/ethanselzer/react-hover-observer.git 2cd react-hover-observer 3yarn
See available commands:
1npm run
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
110 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More