@gravity-ui/uikit
Version:
Gravity UI base styling and components
17 lines (16 loc) • 532 B
TypeScript
import * as React from 'react';
export interface UseOutsideClickProps<T> {
ref: React.RefObject<T>;
handler?: (e: MouseEvent | TouchEvent) => void;
}
type UseOutsideClickType = <K extends HTMLElement>(props: UseOutsideClickProps<K>) => void;
/**
* Hook for observing clicks outside a given target
*
* @param ref - purpose of observation
* @param handler - callback when a click is triggered outside the observation target
*
* @return - nothing
*/
export declare const useOutsideClick: UseOutsideClickType;
export {};