useOnOutsideClick
A utility hook that calls a user-provided callback function when the user clicks outside of the provided container.
Examples
Default
Could not load examples for Primer component library: product
Prevent callback when clicking specified elements
You can also pass an array of ignoredRefs
to prevent calling the callback function on additional elements on the page. This can be handy for ignoring clicks on trigger buttons that already manage the open/closed state of content.
Could not load examples for Primer component library: product
API
Loading data for useOnOutsideClick...