Menu
The Dropdown Menu components provide end users with a list of options on temporary surfaces.
useDropdown API
Import
import { useDropdown } from '@mui/base/useDropdown';
// or
import { useDropdown } from '@mui/base';
The name of the component using useDropdown. For debugging purposes.
Type:string
Default:'useDropdown'
Callback fired when the component requests to be opened or closed.
Type:(event: React.MouseEvent | React.KeyboardEvent | React.FocusEvent | null, open: boolean) => void
useMenu API
Import
import { useMenu } from '@mui/base/useMenu';
// or
import { useMenu } from '@mui/base';
If true
(Default) will focus the highligted item. If you set this prop to false
the focus will not be moved inside the Menu component. This has severe accessibility implications and should only be considered if you manage focus otherwise.
Type:boolean
Default:true
The name of the component using useMenu. For debugging purposes.
Type:string
Default:'useMenu'
If true
, it will be possible to highlight disabled items.
Type:boolean
Default:true
If true
, the highlight will not wrap around the list if arrow keys are used.
Type:boolean
Default:false
Action dispatcher for the menu component. Allows to programmatically control the menu.
Type:(action: ListAction<string>) => void
Resolver for the listbox slot's props.
Type:<ExternalProps extends Record<string, unknown> = {}>(externalProps?: ExternalProps) => UseMenuListboxSlotProps
useMenuButton API
Import
import { useMenuButton } from '@mui/base/useMenuButton';
// or
import { useMenuButton } from '@mui/base';
Resolver for the root slot's props.
Type:<ExternalProps extends Record<string, unknown> = {}>(externalProps?: ExternalProps) => UseMenuButtonRootSlotProps<ExternalProps>
useMenuItem API
Import
import { useMenuItem } from '@mui/base/useMenuItem';
// or
import { useMenuItem } from '@mui/base';
Resolver for the root slot's props.
Type:<ExternalProps extends Record<string, unknown> = {}>(externalProps?: ExternalProps) => UseMenuItemRootSlotProps<ExternalProps>
useMenuItemContextStabilizer API
Import
import { useMenuItemContextStabilizer } from '@mui/base/useMenuItem';
// or
import { useMenuItemContextStabilizer } from '@mui/base';