UNPKG

1.63 kBTypeScriptView Raw
1import type { DOMMountOptions } from "../../common/utils/mountOptions";
2import { type ContextMenuPopoverProps } from "./contextMenuPopover";
3/**
4 * Show a context menu at a particular offset from the top-left corner of the document.
5 * The menu will appear below-right of this point and will flip to below-left if there is not enough
6 * room onscreen. Additional props like `onClose`, `isDarkTheme`, etc. can be forwarded to the `<ContextMenuPopover>`.
7 *
8 * Context menus created with this API will automatically close when a user clicks outside the popover.
9 * You may force them to close by using `hideContextMenu()`.
10 *
11 * Note that this API relies on global state in the @blueprintjs/core package, and should be used with caution,
12 * especially if your build system allows multiple copies of Blueprint libraries to be bundled into an application at
13 * once.
14 *
15 * Alternative APIs to consider which do not have the limitations of global state:
16 * - `<ContextMenu>`
17 * - `<ContextMenuPopover>`
18 *
19 * @see https://blueprintjs.com/docs/#core/components/context-menu-popover.imperative-api
20 */
21export declare function showContextMenu(props: Omit<ContextMenuPopoverProps, "isOpen">, options?: DOMMountOptions<ContextMenuPopoverProps>): void;
22/**
23 * Hide a context menu that was created using `showContextMenu()`.
24 *
25 * Note that this API relies on global state in the @blueprintjs/core package, and should be used with caution.
26 *
27 * @see https://blueprintjs.com/docs/#core/components/context-menu-popover.imperative-api
28 */
29export declare function hideContextMenu(options?: DOMMountOptions<ContextMenuPopoverProps>): void;