@blueprintjs/core
Version:
Core styles & components
46 lines (30 loc) • 2.01 kB
Markdown
@class="@ns-callout @ns-intent-primary @ns-icon-info-sign @ns-callout-has-body-content">
<h5 class="@ns-heading">
Consider [Context Menu](
</h5>
The APIs described on this page are lower-level and have some limitations compared to
[ ](
</div>
**Context Menu Popover** is a lower-level API for [**Context Menu**](
not hook up any interaction handlers for you and simply renders an opinionated
[**Popover**](
[**Portal**](
@reactExample ContextMenuPopoverExample
@
Use the `<ContextMenuPopover>` component like any other React component in your tree. Note that this is a controlled
component which requires its `isOpen` and `targetOffset` props to be defined.
@interface ContextMenuPopoverProps
@
Two functions are provided as an imperative API for showing and hiding a singleton **Context Menu Popover** on
the page:
```ts
export function showContextMenu(props: ContextMenuPopoverProps, options?: ShowContextMenuOptions): void;
export function hideContextMenu(options?: DOMMountOptions<ContextMenuPopoverProps>): void;
```
These are useful in some cases when working with imperative code that does not follow typical React paradigms.
Note that these functions come with come caveats, and thus they should be used with caution:
- they rely on global state stored in Blueprint library code.
- they create a new React DOM tree via `ReactDOM.render()` (or `ReactDOM.createRoot()` if you override the
default renderer via `options`), which means they do not preserve any existing React context from the calling code.
- they do _not_ automatically detect dark theme, so you must manualy set the `{ isDarkTheme: true }` property
<div