Skip to content

MenuItemProps

The MenuItemProps object is used to create a menu item.

type MenuItemProps = {
onClick?: React.MouseEventHandler<HTMLButtonElement>;
disabled?: boolean;
divider?: 'before' | 'after' | 'both';
icon?: React.ReactNode;
leadingIcon?: React.ReactNode;
trailingIcon?: React.ReactNode;
};

Properties

PropertyTypeDescription
onClickReact.MouseEventHandler<HTMLButtonElement> | undefinedFunction that runs when MenuItem is clicked
disabledboolean | undefinedIndicates if MenuItem is disabled. Disabled items will not cause the Menu to close when clicked.
divider'before' &#124; 'after' &#124; 'both' | undefinedIndicate that a divider line should be added before or after this MenuItem
iconReact.ReactNode | undefinedReact component icon that will be rendered at the end of the MenuItem. Deprecated: Since Spotify 1.2.8. Use leadingIcon or trailingIcon instead
leadingIconReact.ReactNode | undefinedReact component icon that will be rendered at the start of the MenuItem. Since Spotify 1.2.8
trailingIconReact.ReactNode | undefinedReact component icon that will be rendered at the start of the MenuItem. Since Spotify 1.2.8