{"repo":"ooade/react-click-away-listener","free":true,"listed":false,"github":"https://github.com/ooade/react-click-away-listener","clone":"git clone https://github.com/ooade/react-click-away-listener.git","description":":paw_prints: Tiny React Click Away Listener built with React Hooks","language":"TypeScript","stars":177,"topics":["click-away","react","react-hooks","event-handler","click-outside","react-19"],"license":"MIT","category":"ui-components","readme_excerpt":"700B React Click Away Listener Installation or - It's quite small in size! Just ') minified, or ') minified & gzipp’d. - It's built with TypeScript . - It works with React Portals (v2.0.0 onwards). - It supports mouse , touch and focus events. Usage Caveats v2.0.0 has breaking changes which uses the React.Children.only API. Note: React.Children.only is considered a legacy API as of React 19. See the React docs for details. Thus, the following caveats apply for the children of the component: 1. You may pass only one child to the component. 2. You may not pass plain text nodes to the component. Violating the above caveats will result in the following error: If you have multiple child components to pass, you can simply wrap them around a React Fragment like so: Or if you only have text nodes, you can also wrap them in a React Fragment like so: Props Name Type Default Description ----------- ------------------------------------------- ---------- --------------------------------------------------------- onClickAway (event) = void Fires when a user clicks outside the click away component mouseEvent 'click' \\ 'mousedown' \\ 'mouseup' 'click' The mouse event type that gets fired on ClickAway touchEvent 'touchstart' \\ 'touchend' 'touchend' The touch event type that gets fired on ClickAway focusEvent 'focusin' \\ 'focusout' 'focusin' The focus event type that gets fired on ClickAway extraEvents Array&lt;keyof DocumentEventMap&gt; Extra events to listen for (e.g. keydown ) Examples - A si","default_branch":null,"files":null,"tree":[],"storefront":"/r/ooade","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ooade/react-click-away-listener/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}