You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* chore(nvmrc): bump node version a little higher
* chore(workflow): run test on .nvmrc change
* chore(workflow): separate test on main from PR
* chore(package.json): remove unused
* chore(workflow): switch to npm
* chore(workflow): package managers bin wilding
Copy file name to clipboardExpand all lines: README.md
+23-17Lines changed: 23 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,11 +15,17 @@
15
15
16
16
## Installation
17
17
18
+
```sh
19
+
npm install react-click-away-listener
20
+
```
21
+
22
+
or
23
+
18
24
```sh
19
25
yarn add react-click-away-listener
20
26
```
21
27
22
-
- It's quite **small** in size! Just [")](https://bundlephobia.com/result?p=react-click-away-listener) minified, or [")](https://bundlephobia.com/result?p=react-click-away-listener) minified & gzipp’d.
28
+
- It's quite **small** in size! Just [')](https://bundlephobia.com/result?p=react-click-away-listener) minified, or [')](https://bundlephobia.com/result?p=react-click-away-listener) minified & gzipp’d.
23
29
- It's built with **TypeScript**.
24
30
- It works with [React Portals](https://reactjs.org/docs/portals.html) ([v2.0.0](https://github.com/ooade/react-click-away-listener/releases/tag/v2.0.0) onwards).
25
31
- It supports **mouse**, **touch** and **focus** events.
@@ -37,7 +43,10 @@ const App = () => {
37
43
return (
38
44
<div id="app">
39
45
<ClickAwayListener onClickAway={handleClickAway}>
40
-
<div> Triggers whenever a click event is registered outside this div element </div>
46
+
<div>
47
+
{''}
48
+
Triggers whenever a click event is registered outside this div element{''}
49
+
</div>
41
50
</ClickAwayListener>
42
51
</div>
43
52
);
@@ -66,11 +75,11 @@ If you have multiple child components to pass, you can simply wrap them around a
66
75
```jsx
67
76
// Assume the `handleClickAway` function is defined.
68
77
<ClickAwayListener onClickAway={handleClickAway}>
69
-
<>
70
-
<p>First paragraph</p>
71
-
<button>Example Button</button>
72
-
<p>Second paragraph</p>
73
-
</>
78
+
<>
79
+
<p>First paragraph</p>
80
+
<button>Example Button</button>
81
+
<p>Second paragraph</p>
82
+
</>
74
83
</ClickAwayListener>
75
84
```
76
85
@@ -79,21 +88,18 @@ Or if you only have text nodes, you can also wrap them in a [React Fragment](htt
79
88
```jsx
80
89
// Assume the `handleClickAway` function is defined.
0 commit comments