Menu
and MenuItem
modules can be used to
create custom native menus.
There are two kinds of menus: the application (top) menu and context (right-click) menu.
Open the full API documentation(opens in new window) in your browser.
The Menu
and MenuItem
modules allow you to
customize your application menu. If you don't set any menu, Electron
will generate a minimal menu for your app by default.
If you click the 'View' option in the application menu and then the 'App Menu Demo', you'll see an information box displayed.
When designing an app for multiple operating systems it's important to be mindful of the ways application menu conventions differ on each operating system.
For instance, on Windows, accelerators are set with an
&
. Naming conventions also vary, like between
"Settings" or "Preferences". Below are resources for learning
operating system specific standards.
A context, or right-click, menu can be created with the
Menu
and MenuItem
modules as well. You can
right-click anywhere in this app or click the demo button to see an
example context menu.
In this demo we use the ipcRenderer
module to show the
context menu when explicitly calling it from the renderer process.
See the full context-menu event documentation for all the available properties.