Add submenu support
macdevign opened this issue · 2 comments
macdevign commented
Hi,
is it possible to have submenu ?
Can this be added if it yet to be supported ?
sindresorhus commented
You can add menu items yourself by either prepending or appending. A menu item can have a submenu. This is all in the docs.
ithil commented
For anyone still searching: it's in the Electron docs not in the electron-context-menu
docs. And it would look like this:
contextMenu({
prepend: (defaultActions, parameters, browserWindow) => [
{
label: 'My Menu Item with Children',
submenu: [
{
label: 'Child Item 1',
},
{
label: 'Child Item 2',
},
],
},
]
})
Note that submenu
is an array of MenuItem
s.