Skip to main content
InteractionLevel 2

Context Menu

上下文菜单

WebDesktopMobileDifficulty: Medium

The row of actions that pops up when you right-click something (or long-press it on a phone).

01

Live Demo

Actually clickable

Right-click here

Right-click the text (or hit "Simulate right-click") — the menu only applies to that object.

What you just saw:The browser menu on a right-clicked link, the menu on a right-clicked desktop file, the floating formatting menu that appears over selected text in Notion.

02

What it actually is

A context menu collects "operations that only apply to this one object". Its contents should genuinely depend on the context — right-clicking an image offers "Set as cover photo", right-clicking a filename offers "Rename".

context menuright click menusecondary menushortcut menuobject menu
03

Anatomy · What it's made of

  1. Trigger触发点

    Right click / long press

  2. Menu菜单容器

    Positioned at the pointer

  3. Item菜单项

    32px tall, icon + label

  4. Separator分隔线

    Groups dangerous actions apart

  5. Shortcut快捷键

    Shown right-aligned, e.g. Command-C

04

When to Use

When it fits, and when it doesn't
Context Menu usage recommendations
SituationUse it?
The actions apply only to a specific objectYes
The actions are low-frequency and not worth main-surface spaceYes
You need to keep the main interface clearYes
These actions are high-frequencyNo
It is the only entry point on mobileNo

Mobile has no right click, and a long-press menu can collide with the system or browser default menu at the system layer.

Past about eight items you should group them or choose a different form.

05

Similar Patterns

Don't mix these up
06

How to tell AI

Three levels of prompt

Add the component name and specifics

Right-click a file to open a menu: Copy / Move to… / Rename / (separator) / Delete (red, at the bottom). Support keyboard navigation up and down.

07

Don't just say this to AI

Bad → Better

Don't say this to AI

Right click pops up a menu.

Say this instead

Add a Context Menu: listen for contextmenu and preventDefault, position the Popover at the pointer with viewport-edge flipping, use role=menu/menuitem, make Up/Down/Enter/Esc work, isolate dangerous items behind a separator at the bottom in red, and show shortcuts on the right.

08

Share this card

Social-ready

Turn this pattern into a 3:4 or 1:1 knowledge card and export it as PNG right in the browser. No backend needed.