Context Menu
A pointer-anchored popup menu triggered by right-clicking (or long-pressing) an element, surfacing actions scoped strictly to that target's context
Table of Contents
Interactive Playground
Tap or drag to interact with the demoWhat is Context Menu?
A pointer-anchored popup menu triggered by right-clicking (or long-pressing) an element, surfacing actions scoped strictly to that target's context. It is a core concept in UI Components within UI / UX.
Core Principles
A Context Menu appears right at the pointer location when a user right-clicks (or long-presses) a specific object, exposing only the actions relevant to that target. By keeping secondary commands out of sight until needed, it keeps dense canvases, file trees, and tables clean while empowering keyboard-and-mouse power users.
Its biggest ergonomic win is minimal pointer travel: users can duplicate, rename, or move an item right where their cursor already rests.
Practical Takeaways
- Never make it the only way to reach a feature: Context menus have low discoverability and don't exist naturally on touchscreens. Mirror critical actions via a visible
⋮overflow button, toolbar, or mobile long-press sheet. - Group logically, show shortcuts, and isolate destructive items: Separate action families with dividers, align keyboard shortcuts (
⌘D,Del) to the right for progressive learning, and isolateDeleteat the bottom below a divider. - Protect submenus and viewport edges: Use a safe-triangle hover corridor so moving diagonally into a submenu doesn't close it prematurely, and clamp coordinates so menus never clip off-screen.
Notable Examples
- Design canvases (Figma, Miro): Right-clicking a layer surfaces
Add Auto Layout,Create Component, andBring to Front. - Cloud file explorers (Google Drive, Finder): File-scoped menus for
Share,Rename,Move to ▶, andMove to Trash. - Mobile long-press menus: iOS context menus with haptic preview and quick actions on messages or photos.