By default a menu and its items don't get mounted into DOM until the menu has been opened for the first time. This means if you render a menu on the server side, there won't be any HTML string output. You can set the initialMounted prop to render a menu and all of its descendants before being opened.
<Menu initialMounted />Or, when using ControlledMenu along with useMenuState
useMenuState({ initialMounted: true });The label prop of a submenu accepts not only a plain string but any valid JSX element as well.
<SubMenu
label={
<>
<img src="edit.png" alt="edit" />
Edit
<ArrowIcon />
</>
}
/>You can use the itemProps to pass additional props to a submenu label.
<SubMenu
itemProps={{
className: 'submenu-label',
style: { backgroundColor: 'lightblue' },
onClick: () => console.log('Clicked!')
}}
/>