Gathering detailed insights and metrics for react-outside-click-handler-temp
Gathering detailed insights and metrics for react-outside-click-handler-temp
Gathering detailed insights and metrics for react-outside-click-handler-temp
Gathering detailed insights and metrics for react-outside-click-handler-temp
OutsideClickHandler component for React.
npm install react-outside-click-handler-temp
Typescript
Module System
Node Version
NPM Version
61.6
Supply Chain
75.6
Quality
73.9
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
54,363
Last Day
19
Last Week
152
Last Month
590
Last Year
15,701
MIT License
620 Stars
45 Commits
64 Forks
25 Watchers
2 Branches
29 Contributors
Updated on May 07, 2025
Minified
Minified + Gzipped
Latest Version
1.2.5
Package Id
react-outside-click-handler-temp@1.2.5
Unpacked Size
36.02 kB
Size
7.75 kB
File Count
17
NPM Version
6.10.3
Node Version
10.16.1
Cumulative downloads
Total Downloads
Last Day
533.3%
19
Compared to previous day
Last Week
72.7%
152
Compared to previous week
Last Month
-46.5%
590
Compared to previous month
Last Year
-13.5%
15,701
Compared to previous year
24
A React component for handling outside clicks
1import OutsideClickHandler from 'react-outside-click-handler'; 2 3function MyComponent() { 4 return ( 5 <OutsideClickHandler 6 onOutsideClick={() => { 7 alert('You clicked outside of this component!!!'); 8 }} 9 > 10 Hello World 11 </OutsideClickHandler> 12 ); 13}
PropTypes.node.isRequired
Since the OutsideClickHandler
specifically handles clicks outside a specific subtree, children
is expected to be defined. A consumer should also not render the OutsideClickHandler
in the case that children
are not defined.
Note that if you use a Portal
(native or react-portal
) of any sort in the children
, the OutsideClickHandler
will not behave as expected.
PropTypes.func.isRequired
The onOutsideClick
prop is also required as without it, the OutsideClickHandler
is basically a heavy-weight <div />
. It takes the relevant clickevent as an arg and gets triggered when the user clicks anywhere outside of the subtree generated by the DOM node.
PropTypes.bool
If the disabled
prop is true, outside clicks will not be registered. This can be utilized to temporarily disable interaction without unmounting/remounting the entire tree.
PropTypes.bool
See https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture for more information on event bubbling vs. capture.
If useCapture
is true, the event will be registered in the capturing phase and thus, propagated top-down instead of bottom-up as is the default.
PropTypes.oneOf(['block', 'flex', 'inline-block', 'inline', 'contents'])
By default, the OutsideClickHandler
renders a display: block
<div />
to wrap the subtree defined by children
. If desired, the display
can be set to inline-block
, inline
, flex
, or contents
instead. There is no way not to render a wrapping <div />
.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 5/26 approved changesets -- score normalized to 1
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
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-05-05
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