useMenu API
Demos
For examples and details on the usage of this React hook, visit the demo pages:
Import
import useMenu from '@mui/base/useMenu';Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| listboxId | string | ||
| listboxRef | React.Ref<any> | ||
| onClose | () => void | ||
| open | boolean |
Return value
| Name | Type | Default | Description |
|---|---|---|---|
| contextValue | MenuUnstyledContextType | The value for the menu context. | |
| getListboxProps | <TOther extends EventHandlers>(otherHandlers?: TOther) => UseMenuListboxSlotProps | Resolver for the listbox component's props. | |
| highlightedOption | string | null | The highlighted option in the menu listbox. | |
| highlightFirstItem | () => void | Callback for highlighting the first item in the menu listbox. | |
| highlightLastItem | () => void | Callback for highlighting the last item in the menu listbox. | |
| menuItems | Record<string, MenuItemMetadata> | Items in the menu listbox. |