Skip to content

Latest commit

 

History

History
34 lines (29 loc) · 1.01 KB

contextMenu.en-US.md

File metadata and controls

34 lines (29 loc) · 1.01 KB

ContextMenu

A right-click menu that can show or hide the menu, configuate with the commands button and control its available and disabled states.

Usage

It must be used with the <Command /> component. The corresponding menu is displayed according to different states in the page. For example, when the node is selected, only the NodeMenu will be displayed.

import GGEditor, {
  Flow,
  Command,
  ContextMenu,
  NodeMenu,
  EdgeMenu,
  GroupMenu,
  MultiMenu,
  CanvasMenu,
} from 'gg-editor';

<GGEditor>
  <Flow />
  <ContextMenu>
    <NodeMenu>     // context menu when right-click on a node
      <Command name="copy">Copy</Command>
      <Command name="delete">Delete</Command>
    </NodeMenu>
    <EdgeMenu />   // context menu when right-click on an edge
    <GroupMenu />  // context menu when right-click on a group
    <MultiMenu />  // context menu when right-click on multiple items
    <CanvasMenu /> // context menu when right-click on a canvas
  </ContextMenu>
</GGEditor>