showContextMenu

showContextMenu

Show a context menu at the given location.

await framer.showContextMenu(
  [
    {
      label: "Edit",
      enabled: item.isEditable,
      onAction: () => editItem(item)
    },
    { type: "separator" },
    {
      label: "Remove",
      onAction: () => removeItem(item),
    },
  ],
  {
    location: { x: event.clientX, y: event.clientY },
    placement: "bottom-left",
    width: 220,
  }
)

Placement is relative to the location.

Parameters

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

  • config: ContextMenuConfig – Configuration for positioning the context menu.

Returns

  • Promise<void>