Menu
A menu opens from a button or a right click and lists the commands that apply to what people are working on. Picking a command runs it and closes the menu.
When to use it
Use a menu for commands that do not earn a place on the toolbar, such as sending an offer from a candidate's row or moving the row to another group, and for a short setting such as the order of a list.
For a value in a form field, use a select or a combobox, and for a few controls on one item, a popover.
Anatomy
Rows carry text only. A check marks the chosen option and a chevron a submenu, and a shortcut sits at the right end of its row.
- Width
- 200 to 300 px, set by the longest label
- Padding around the rows
- 4 px
- --space-1
- Corner radius
- 12 px, rows 8 px
- --radius-xl, --radius-lg
- Row height
- 36 px, 44 px on touch screens
- Row padding
- 10 px on each side
- Label
- 13 px on a 20 px line, regular weight
- --type-caption, --text
- Shortcut
- 11 px in tabular digits, at least 10 px from the label
- --text-muted
- Check and chevron
- 16 px, the check in the brand blue
- --brand-blue, --text-muted
- Separator
- 1 px, 4 px above and below
- --border-rule
Commands and choices
A command runs and closes the menu. Where one option applies, the chosen one carries a check and a pick closes the menu. Where several apply, a pick toggles its check and the menu stays open, so people can set several in one visit.
Order and groups
Put the most used commands at the top and related ones in one group, with a line between groups and at most three groups. Destructive commands go last, in their own group, in the error ink.
Name a group only when its items do not explain it, as with Sort by. A submenu goes one level deep. When there are dozens of groups to move a row to, a combobox takes its place.
States
The pointer shows as a fill and the keyboard as a ring, so people can tell which one moved. An unavailable command stays in a button menu, faded, so people learn it exists.
- Hover
- a faint fill in the text color, 6 percent in dark, 5.5 percent in light
- Keyboard focus
- 2 px ring inside the row
- --focus-ring
- Pressed
- darker fill
- --glass-fill-active
- Unavailable
- quieter text at half opacity, no fill, still reachable by keyboard
- --text-muted
- Destructive
- error ink
- --error-ink
- Trigger while open
- control fill
- --surface-control
Keyboard
- Enter, Space or Down arrow on the trigger
- opens on the first command, Up arrow on the last
- Arrows, Home, End
- move between commands, wrapping at the ends
- A letter
- next command that starts with it
- Enter or Space
- runs the command
- Right and Left arrows
- open and close a submenu
- Escape
- closes the menu and returns focus to the trigger
- Tab
- closes the menu and moves on
- Shift+F10 or the Menu key
- opens the focused row's context menu
Content
Start a command with a verb, in sentence case without a full stop, and add the noun when the verb alone could mean two things. Keep its words the same in the menu, on the toolbar and in the context menu.
Permitted
Move to group
It says what happens.
Delete last, in its own group
Harder to hit by accident.
Not permitted
An icon in front of each label
Menus carry text only.
Options
It names no action.
Accessibility
The menu has role menu and takes its name from the trigger, which carries aria-haspopup, aria-expanded and aria-controls. Rows are menuitem, menuitemcheckbox or menuitemradio, with aria-checked on the last two.