UNPKG

@supunlakmal/hooks

Version:

A collection of reusable React hooks

12 lines (11 loc) 616 B
import { RefObject } from 'react'; type EventType = 'mousedown' | 'mouseup' | 'touchstart' | 'touchend'; /** * Custom hook for detecting clicks outside of a specified element. * * @param {RefObject<HTMLElement>} ref The React ref attached to the element to monitor. * @param {() => void} handler The function to call when a click outside occurs. * @param {EventType} [eventType='mousedown'] The type of event to listen for ('mousedown', 'mouseup', 'touchstart', 'touchend'). */ export declare const useClickOutside: (ref: RefObject<HTMLElement>, handler: () => void, eventType?: EventType) => void; export {};