• The follows the Menu design pattern from WAI-ARIA APG (https://www.w3.org/WAI/ARIA/apg/patterns/menu/). Only use when this pattern is what you want. For other situations, you should create your own popup using Dialog, Popover or BotttomSheet components.
  • Arrow key support is handled internally via MUI composition (https://mui.com/material-ui/react-menu/#menulist-composition).
  • Children sent into the Menu must be components with an appropriate variant prop.
  • Developers are responsible for managing the selected state and actions of the .
  • When using checkbox, switch or radio variant , make sure that the Menu has the showButton prop and that the Menu does not close automatically on selection. Refer to the stories.
  • The component inserts an extra, visually hidden "Close" at the end to help screen reader users close the Menu on mobile devices.
  • Parameters

    Returns ReactNode

Properties

contextTypes?: ValidationMap<any>

Lets you specify which legacy context is consumed by this component.

defaultProps?: Partial<MenuProps>

Used to define default values for the props accepted by the component.

type Props = { name?: string }

const MyComponent: FC<Props> = (props) => {
return <div>{props.name}</div>
}

MyComponent.defaultProps = {
name: 'John Doe'
}
displayName?: string

Used in debugging messages. You might want to set it explicitly if you want to display a different name for debugging purposes.


const MyComponent: FC = () => {
return <div>Hello!</div>
}

MyComponent.displayName = 'MyAwesomeComponent'
propTypes?: WeakValidationMap<MenuProps>

Used to declare the types of the props accepted by the component. These types will be checked during rendering and in development only.

We recommend using TypeScript instead of checking prop types at runtime.