@leafygreen-ui/hooks
Version:
LeafyGreen UI Kit Custom Hooks
24 lines • 822 B
TypeScript
/// <reference types="react" />
/**
* Fires a callback when any element(s)
* _except_ those passed in as `foreground` is clicked.
*
* Note: Disable this hook (with the `enabled` arg)
* if the `foreground` element(s) are not in view (e.g. menu, tooltip, etc.).
*/
export declare function useBackdropClick(
/**
* Function called when any element other than those provided is clicked
*/
callback: Function,
/**
* The primary element(s) that are excluded from backdrop click
*/
foreground: React.RefObject<HTMLElement> | Array<React.RefObject<HTMLElement>>,
/**
* Whether the callback is enabled.
* It's recommended to set this to `false` when not in use,
* and toggle to `true` when the main elements (menu, tooltip, etc) are visible
*/
enabled?: boolean): void;
//# sourceMappingURL=useBackdropClick.d.ts.map