ContextMenu
AppRight-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.
<%- 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 },
]
}) %>
<% 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 },
]
}) %>
<% }); %>
<%- 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 },
]
}) %>
<%
var _id = locals.id || 'ctx-' + Math.random().toString(36).substr(2, 9);
var _items = locals.items || [];
var _disabled = !!locals.disabled;
var _class = locals.className || '';
%>
"
>
<%- locals.children || '' %>