UNPKG

@supunlakmal/hooks

Version:

A collection of reusable React hooks

11 lines (10 loc) 501 B
import { RefObject } from 'react'; /** * A hook that triggers a callback when the user clicks outside a specified element * OR presses the 'Escape' key. * Combines useClickOutside and useKeyPress. * * @param ref The RefObject pointing to the element to monitor for outside clicks. * @param callback The function to call when an outside click or Escape key press occurs. */ export declare function useClickOutsideWithEscape<T extends HTMLElement>(ref: RefObject<T>, callback: () => void): void;