# `` Tracks clicks outside its `children` or `clickRoots()`. ## Usage ### Default ```jsx import {OutsideClick} from 'libreact/lib/OutsideClick';
Don't click here.
``` ### Using a Portal ```jsx import {OutsideClick} from 'libreact/lib/OutsideClick'; ([ document.getElementById('my-portal-root') ])}>
Click anywhere outside `#my-portal-root` and my `onClick` will fire.
``` ## Props - `onClick` — event called when user click outside of its children. - `event` — optional, string, event name subscribe to, defaults to `mousedown`. - `clickRoots` — optional, function that should return an array of DOM nodes. These should be considered where the user clicks inside, i.e. clicking outside of these roots will fire `onClick`.