Components
Known Limitations (Beta)
- Don’t use MenuGroup in scrollable menus
Menus display a list of choices on a temporary surface. They appear when users interact with a button, action, or other control.
One common use case for Menus is the Exposed Dropdown Menu, integrated into TextField (often called a “Select”).
Exposed Dropdown Menu (Select)
Use TextField with type="select" to create a dropdown menu. Pass MenuItem components as children to define the options.
Color options
Menus have two color mappings:
- Standard: Surface-based, lower visual emphasis.
- Vibrant: Tertiary-based, higher visual emphasis.
Menu Dividers
Vertical menu items can be grouped by adding a divider or small gap. Use groups to bundle similar actions together.
Grouped Menu Items
Use MenuGroup to visually divide menu items into distinct groups with a gap and separator.
Scrollable Menu
Menus can scroll when all menu items can’t display at once.
Filter Chip Menu
A menu can be triggered by a Filter Chip.
Submenus
Submenus can be created by passing a Menu component to the subMenu prop of a MenuItem.
Icon Button Menu
Menus are often triggered by an icon button, such as the “kebab” menu (three vertical dots).
Context Menu
Menus can be opened via right-click interaction (context menu).
<ContextMenu
trigger={
<Card className="p-8 flex items-center justify-center bg-surface-container-low border-dashed border-2 border-outline-variant cursor-context-menu">
<span className="text-on-surface-variant">Right click here</span>
</Card>
}
>
<MenuItem value="view">View Details</MenuItem>
<MenuItem value="open">Open in new tab</MenuItem>
<Divider />
<MenuItem value="properties">Properties</MenuItem>
</ContextMenu> Anatomy
- Menu item
- Leading icon (optional)
- Menu item text
- Trailing icon (optional)
- Badge (optional)
- Trailing text (optional)
- Container
- Supporting text (optional)
- Label text (optional)
- Gap (optional)
- Divider (optional)