showContextMenu

Beta
Beta

showContextMenu

showContextMenu

Show a context menu at a given location.

await framer.showContextMenu(
  [
    {
      label: "Edit",
      enabled: item.isEditable,
      onAction: () => editItem(item)
    },
    {
      label: "Status",
      submenu: [
        {
          label: "Pending",
          checked: priority === "pending",
          onAction: () => setStatus("pending"),
        },
        {
          label: "Done",
          checked: priority === "done",
          onAction: () => setStatus("done"),
        },
      ],
    },
    { type: "separator" },
    {
      label: "Remove",
      onAction: () => removeItem(item),
    },
  ],
  { location: { x: event.clientX, y: event.clientY } }
)

Parameters

  • menuItems: MenuItem[] — The entries to add to the context menu.

  • config: ContextMenuConfig[] — Configuration for showing the context menu.

Returns

  • Promise<void>

Caveats