@grafana/ui
Version:
Grafana Components Library
19 lines (18 loc) • 1.1 kB
TypeScript
import * as React from 'react';
export interface Props {
/** Callback to trigger when clicking outside of current element occurs. */
onClick: () => void;
/** Runs the 'onClick' function when pressing a key outside of the current element. Defaults to true. */
includeButtonPress?: boolean;
/** Object to attach the click event listener to. */
parent?: Window | Document;
/** https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener. Defaults to false. */
useCapture?: boolean;
children: React.ReactNode;
}
/**
* A wrapper component that detects clicks outside of the elements by attaching event listener to `window` or `document` objects. Useful for components that require an action being triggered when a click outside has occurred, for example closing an overlay or popup.
*
* https://developers.grafana.com/ui/latest/index.html?path=/docs/utilities-clickoutsidewrapper--docs
*/
export declare function ClickOutsideWrapper({ includeButtonPress, parent, useCapture, onClick, children, }: Props): import("react/jsx-runtime").JSX.Element;