Menu
The Menu component is designed to render a list of MenuItem components, providing a dropdown menu interface for users to select an option or take an action. The MenuItem component is used within Menu to create individual menu items, ensuring each item adheres to the specified menu style.
The MenuTrigger component is used to render a trigger element that opens the Menu when clicked.
Usage Guidelines
Provide a clear and concise label for the MenuTrigger to indicate the purpose of the dropdown menu. Use the Menu component to group related MenuItem components together, ensuring that each item is easily accessible and distinguishable.
Duplicate
Save
<MenuTrigger> <Button>Open Menu</Button> <Menu> <MenuItem id="duplicate">Duplicate</MenuItem> <MenuItem id="save">Save</MenuItem> </Menu></MenuTrigger>Props
MenuTrigger Props
How the menu is triggered.
Whether the overlay is open by default (controlled).
Whether the overlay is open by default (uncontrolled).
Handler that is called when the overlay's open state changes.
Menu Props
Optional class name to apply to the menu.
The children to render in the menu.
Optional array of keys to disable.
Handler that is called when an item is selected.
MenuItem Props
Whether the menu item is disabled.
Optional title to apply to the menu item.
The children to render in the menu item.
The unique id of the item.
The object value that this item represents. When using dynamic collections, this is set automatically.
A string representation of the item's contents, used for features like typeahead.
Handler that is called when the item is selected.
The CSS className for the element. A function may be provided to compute the class based on component state.
The inline style for the element. A function may be provided to compute the style based on component state.
A URL to link to. See MDN.
Hints at the human language of the linked URL. SeeMDN.
The target window for the link. See MDN.
The relationship between the linked resource and the current page. See MDN.
Causes the browser to download the linked URL. A string may be provided to suggest a file name. See MDN.
A space-separated list of URLs to ping when the link is followed. See MDN.
How much of the referrer to send when following the link. See MDN.
Options for the configured client side router.
Handler that is called when a hover interaction starts.
Handler that is called when a hover interaction ends.
Handler that is called when the hover state changes.
Handler that is called when the press is released over the target.
Handler that is called when a press interaction starts.
Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.
Handler that is called when the press state changes.
Handler that is called when a press is released over the target, regardless of whether it started on the target or not.
Not recommended – use onPress instead. onClick is an alias for onPress
provided for compatibility with other libraries. onPress provides
additional event details for non-mouse interactions.