Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add submenu support #114

Closed
macdevign opened this issue Jul 26, 2020 · 2 comments
Closed

Add submenu support #114

macdevign opened this issue Jul 26, 2020 · 2 comments

Comments

@macdevign
Copy link

Hi,
is it possible to have submenu ?
Can this be added if it yet to be supported ?

@sindresorhus
Copy link
Owner

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
Copy link

ithil commented Dec 23, 2021

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 MenuItems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants