DocsDocs

Menu

Actions and destinations, opened from a trigger or a right click.

StableSince 1.0.0
On this page

Overview

Show code, IconsAndShortcuts.tsx

Variants

Context menu

ContextMenu opens a menu for an area on right click, long press, the Menu key or Shift+F10.

Show code, ContextMenuForRows.tsx

Groups and separators

Groups put items under a heading, and separators split sets without one.

Still picture, not live

Show code, GroupsAndSeparators.tsx

Radio and checkbox items

Items can be choices, checked in place.

  • A radio item checks one choice and closes the menu; the chosen one takes the selection's fill as well as its check mark.
  • A checkbox item toggles and keeps it open.
Show code, Choices.tsx

A submenu's row opens a nested menu beside it, on hover or with →.

Show code, Submenus.tsx

Destinations

An item can go to a page, as a link the application's router follows.

Still picture, not live

Show code, Destinations.tsx

Anatomy

  1. Menu

  2. Group label

  3. Item

  4. Icon

  5. Shortcut

  6. Description

  7. Separator

Show code, MenuAnatomy.tsx

Rules

A menu puts what people use most first, and keeps every item in its place.

Use it when

  • A short list of actions behind one control, such as More actions
  • A few destinations behind one control, such as the account's pages
  • Options that change a view, such as a sort order
  • Actions for an area on right clickContextMenu
DoFrequent actions first, and a destructive one last, apart.
Show code, FrequentFirst.tsx
Don’tDelete first, where the keyboard lands.
Show code, DeleteFirst.tsx
DoKeep an unavailable item, disabled, with a description of why.
Show code, DisabledWithReason.tsx

A menu holds items only, one level deep.

  • Keep submenus to one level, with frequent commands out of them.
  • Put no fields or other controls inside a menu.

Content

Start an action with a verb, such as Rename, and name a destination after its page. Show a shortcut only where the application handles its keys.

Accessibility

KeyAction
Enter, Space or ↓ on the triggerOpens the menu with its first item highlighted.
↓, ↑, Home, EndMoves the highlight; a letter jumps to the next item that starts with it.
Enter, SpaceChooses the highlighted item.
→, ←Opens a submenu, or closes it.
EscCloses the menu and returns focus to the trigger.
Shift+F10 or MenuOpens a ContextMenu at the focused element.