ContextMenu

App

Right-click context menu. Wraps any element as a trigger. Supports item groups, keyboard shortcuts, separators, danger items, and disabled items. Positions itself via viewport-aware boundary detection, auto-flips when near screen edges. Full keyboard navigation: ↑↓ arrows, Enter, Escape.

Text editor — clipboard + format actions

Preview
Right-click anywhere in this area
Code
<%- include('modules/app/ContextMenu', {
  children: '
Right-click anywhere in this area
', items: [ { label: 'Cut', icon: '', shortcut: '⌘X' }, { label: 'Copy', icon: '', shortcut: '⌘C' }, { label: 'Paste', icon: '', shortcut: '⌘V' }, { type: 'separator' }, { label: 'Copy link', icon: '', shortcut: '⌘⇧C' }, { type: 'separator' }, { label: 'Rename', icon: '' }, { label: 'Delete', icon: '', shortcut: '⌫', danger: true }, ] }) %>

File manager — groups + shortcut hint

Preview
Report Q1.pdf
Design System.fig
README.md
Code
<% files.forEach(function(file) { %>
  <%- include('modules/app/ContextMenu', {
    children: fileCardHtml(file),
    items: [
      { type: 'group', label: 'Actions' },
      { label: 'Open',     icon: '' },
      { label: 'Download', icon: '', shortcut: '⌘D' },
      { label: 'Share',    icon: '', shortcut: '⌘⇧S' },
      { type: 'separator' },
      { type: 'group', label: 'Organise' },
      { label: 'Move to…', icon: '' },
      { label: 'Add tag',  icon: '' },
      { type: 'separator' },
      { label: 'Delete',   icon: '', danger: true },
    ]
  }) %>
<% }); %>

Code branch — some items disabled

Preview
feature/context-menu (right-click)
Code
<%- include('modules/app/ContextMenu', {
  children: branchRowHtml,
  items: [
    { label: 'View diff',        icon: '' },
    { label: 'Copy branch name', icon: '', shortcut: '⌘C' },
    { type: 'separator' },
    { label: 'Merge into main',  icon: '', disabled: true },
    { label: 'Cherry-pick',                                                                 disabled: true },
    { type: 'separator' },
    { label: 'Delete branch',    icon: '', danger: true },
  ]
}) %>
Source modules/app/ContextMenu.ejs