@gravity-ui/uikit
Version:
Gravity UI base styling and components
15 lines (10 loc) • 710 B
Markdown
# useOutsideClick
```tsx
import {useOutsideClick} from '@gravity-ui/uikit';
```
The `useOutsideClick` hook helps to track the click outside of the tracked element.
## Properties
| Name | Description | Type | Default |
| :------ | :---------------------------------------------------------------- | :-------------------------------------: | :-----: |
| ref | Ref-link to target of observation | `React.RefObject` | |
| handler | Callback when a click is triggered outside the observation target | `(e: MouseEvent \| TouchEvent) => void` | |