Menus
Menus display a list of choices on temporary surfaces that appear as a response to user interaction.
Menus allow users make a selection from multiple options. They are less prominent and take up less space than selection controls, such as a set of radio buttons. They appear when users interact with a button, action, or other control.
Simple Menu
Simple menus open over the anchor element by default (this option can be changed via props). When close to a screen edge, simple menus vertically realign to make sure that all menu items are completely visible.
Choosing an option should immediately commit the option and close the menu.
In contrast to simple menus, simple dialogs can present additional detail related to the options available for a list item or provide navigational or orthogonal actions related to the primary task. Although they can display the same content, simple menus are preferred over simple dialogs because simple menus are less disruptive to the user’s current context.
Selected Menus
If used for item selection, when opened, simple menus attempt to vertically align the currently selected menu item with the anchor element. The currently selected menu item is set using the selected
property (from ListItem)
Menu Position
You can customize the menu position with the use of the anchorOrigin
and transformOrigin
properties as seen below.
Also demonstrated is the use of elevation
to reduce the perceived depth of the applied box-shadow
, and use of disableAutoFocusItem
to prevent moving focus to the first menu item.