Guides and Sample Code

Developer

macOS Human Interface Guidelines

iBooks

Contextual Menus

A contextual menu provides convenient access to frequently used commands associated with an item. From the user’s perspective, a contextual menu is a shortcut to a small set of commands that make sense in the context of the current task. A user can reveal a contextual menu by Control-clicking an object or selection.

For example, a document icon can display a contextual menu that helps users perform several file-specific Finder actions. (Note that contextual menus use the vibrant light appearance by default.)

image: ../Art/contextual_menu_2x.png

Control-clicking a text selection displays a contextual menu that’s focused on text-specific actions, such as changing the font or checking the spelling of the text.

image: ../Art/contextual_menu_selection_2x.png

If appropriate, use an Action menu to make contextual menu functionality easier to access. You can use an Action menu to provide an app-wide contextual menu control in a toolbar. For example, the Finder provides an Action menu toolbar control that gives users access to the same commands that are displayed in a contextual menu for the selected item. For some guidelines on how to use an Action menu, see Action Menu.

image: ../Art/action_menu_contextual_2x.png

Include only the most commonly used commands that are appropriate in the current context. For example, it makes sense for editing commands to appear in the contextual menu for highlighted text, but it doesn’t make sense to include a Save or Print command.

Use caution when adding a submenu to a contextual menu. Although you don’t want a contextual menu to grow too long (too-long contextual menus display the scrolling indicator and scroll like standard menus), you also don’t want to make them hard to use. Sometimes, users can find it difficult to maneuver the pointer so that the submenu stays open. If you decide to add submenus to your contextual menu, be sure to keep them to one level. To learn more about submenus, also called hierarchical menus, see Hierarchical Menus.

Don’t set a default item in a contextual menu. If the user opens the menu and closes it without selecting anything, no action should occur.

Always ensure that contextual menu items are also available as menu commands. A contextual menu is hidden by default and a user might not know it exists, so it should never be the only way to access a command. In particular, you want to avoid using a contextual menu as the only way to access an advanced or power-user feature.

Don’t display keyboard shortcuts in a contextual menu. A contextual menu is a shortcut to a set of task-specific commands, so it's redundant to display the keyboard shortcuts for those commands.