Gathering detailed insights and metrics for react-outer-click
Gathering detailed insights and metrics for react-outer-click
Gathering detailed insights and metrics for react-outer-click
Gathering detailed insights and metrics for react-outer-click
npm install react-outer-click
Typescript
Module System
Node Version
NPM Version
66.4
Supply Chain
90.3
Quality
75.8
Maintenance
100
Vulnerability
100
License
JavaScript (99.24%)
Shell (0.76%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
108,118
Last Day
105
Last Week
408
Last Month
1,816
Last Year
25,778
MIT License
5 Stars
174 Commits
2 Forks
1 Watchers
4 Branches
1 Contributors
Updated on Apr 25, 2022
Minified
Minified + Gzipped
Latest Version
3.8.0
Package Id
react-outer-click@3.8.0
Unpacked Size
25.17 kB
Size
5.70 kB
File Count
7
NPM Version
8.6.0
Node Version
17.8.0
Cumulative downloads
Total Downloads
Last Day
81%
105
Compared to previous day
Last Week
-15%
408
Compared to previous week
Last Month
27.2%
1,816
Compared to previous month
Last Year
-18%
25,778
Compared to previous year
3
1
22
React component and hook which detect mouse clicks outside of an element.
useOuterClick
Hook (recommended)1useOuterClick(refs, handler);
refs
a single ref or array of refs to not be handled the user has clickedhandler
callback function to be called when the user has clicked1import { useOuterClick } from 'react-outer-click'; 2 3const Example = (props) => { 4 const el = useRef(null); 5 6 useOuterClick(el, (event) => { 7 event.preventDefault(); 8 console.log('Clicked outside'); 9 }); 10 11 return <div ref={el}>Example</div>; 12};
OuterClick
Component1<OuterClick onOuterClick={}></OuterClick>
children
elements that will not be handled when clickedonOuterClick
callback function to be called when the user has clicked1import { OuterClick } from 'react-outer-click'; 2 3const Example = (props) => { 4 return ( 5 <OuterClick 6 onOuterClick={() => { 7 event.preventDefault(); 8 console.log('Clicked outside'); 9 }} 10 > 11 Example 12 </OuterClick> 13 ); 14};
:warning: Previous versions of react-outer-click allowed
OuterClick
to be imported as default export. This is no longer supported and has been removed.
:information_source: The OuterClick
component will wrap your children with a <div>
element, and any additional props will be passed down. You can change the element rendered with the as
prop:
1 ... 2 <OuterClick as="span" onOuterClick={...}> 3 Example 4 </OuterClick> 5 ...
Requires a minimum of React version 16.8.0. If you're on an older version of React, then checkout v1.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/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
Score
Last Scanned on 2025-02-10
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