Skip to main content
The built-in right-click menu. Shows relevant actions based on cursor position and document state. Configure it via modules.contextMenu, or disable it and render your own.
Building a fully custom right-click menu? See Custom right-click menu for the controller-driven flow: ui.viewport.contextAt({ x, y }) returns one bundle, registrations contribute items via register({ contextMenu: { when } }), and item.invoke() dispatches with the bundle bound. The page below covers the built-in module only.

Quick start

The built-in menu is enabled by default. Right-click anywhere in the document to open it. To turn off the built-in menu, set disableContextMenu: true. This switches off SuperDoc’s own menu and lets the browser’s native right-click menu (Copy / Paste / Inspect) appear, or lets your own custom contextmenu listener take over:

Configuration

boolean
default:"false"
Top-level option that disables the built-in menu and lets the browser’s native right-click menu (or your own custom contextmenu listener) appear instead. Pair with the custom right-click menu flow when you’re rendering your own.
boolean
default:"true"
Whether to include the built-in menu items
Array
default:"[]"
Custom menu sections to add or merge. See Custom Items.
function
Advanced: function to fully control menu contents. See Menu Provider.

Default items

Items shown depend on document context.

Right-click

Spell-check items appear automatically when top-level proofing is enabled and the clicked text has a spelling issue. Suggestion items come from the provider’s replacements array.

Custom items

Add custom items by defining sections in customItems. Each section has an id and an array of items.

Item properties

string
required
Unique identifier for the item
string
required
Display text shown in the menu
string
SVG string for the item icon
function
Handler called when the item is clicked. Receives (editor, context).
Component
Vue component to render as a popover when the item is selected (e.g., a table grid picker)
function
Function that receives the context object and returns boolean. Items without showWhen are always visible.
function
Custom render function for the menu item. Receives the context and should return an HTMLElement.

Merging with default sections

If a custom section has the same id as a default section, the items are merged:
For full control over menu contents, use menuProvider. It receives the context and the computed sections array, and should return a new sections array.
menuProvider runs after default items and customItems are merged. If it returns null or undefined, the original sections are used.

Context object

Both showWhen and menuProvider receive a context object with the current editor state:

Keyboard navigation

When the menu is open: