-
Notifications
You must be signed in to change notification settings - Fork 2.2k
ContextMenu2 migration
Adi Dahiya edited this page Feb 15, 2021
·
9 revisions
-
<ContextMenu2>is provided in the@blueprintjs/popover2package, so make sure to check out the Popover2 migration guide.
The context menu API has been simplified greatly so that it works much more like a popover. The new component does not require your build system to support decorators and it can be used with function components. It wraps a target element which will receive contextmenu events (right click) and expects menu content supplied as a prop:
import { Menu, MenuItem } from "@blueprintjs/core";
import { ContextMenu2 } from "@blueprintjs/popover2";
export default function ContextMenuExample() {
return (
<ContextMenu2
content={
<Menu>
<MenuItem text="Save" />
<MenuItem text="Save as..." />
<MenuItem text="Delete..." intent="danger" />
</Menu>
}
>
<div className="my-context-menu-target">
Right click me!
</div>
</ContextMenu2>
);
}- FAQ
- 6.x Changelog
- 5.x Changelog
- 5.0 pre-release changelog
- 4.x Changelog
- v4.0 & v5.0 major version semantic swap
- v6.0 changes
- Spacing System Migration: 10px to 4px
- react-day-picker v8 migration
- HotkeysTarget & useHotkeys migration
- PanelStack2 migration
- Table 6.0 changes