- Electron Projects
- Denys Vuika
- 221字
- 2021-06-24 12:14:36
Providing menu separators
Let's stop for a moment. Traditionally, in large applications, developers collect menu items into logical groups so that it is much easier for end users to remember and use them.
The following is an example of the File menu from Visual Studio Code, which you are probably using right now to edit project files:

The keyboard shortcuts may differ, depending on the platform you are using, but the structure should be the same with all operating systems.
Note how developers group multiple items into separate areas. If you want to separate two menu items, follow these steps:
- You can use an extra entry that has the type attribute set to separator. This instructs Electron to render a horizontal line to separate items visually.
- Update the code for your Debugging menu so that it looks as follows:
{
label: 'Debugging',
submenu: [
{
label: 'Dev Tools',
role: 'toggleDevTools'
},
{ type: 'separator' },
{ role: 'reload' }
]
}
- Restart the application. Inside the Debugging menu item, you should see two entries: Dev Tools and Reload:

Notice How the horizontal line separates both entries. This is our separator role in action, and you can use as many separators as you like in your menus.
Now, let's learn how Electron handles keyboard shortcuts, also known as accelerators, and key combinations.
- Mastering Concurrency Programming with Java 8
- Kibana Essentials
- Hands-On Machine Learning with scikit:learn and Scientific Python Toolkits
- HTML5 Mobile Development Cookbook
- Instant Typeahead.js
- Hands-On RESTful Web Services with Go
- SQL基礎教程(視頻教學版)
- PHP+MySQL網站開發項目式教程
- Learning DHTMLX Suite UI
- 深度實踐KVM:核心技術、管理運維、性能優化與項目實施
- JavaScript Concurrency
- Android應用程序設計
- MySQL數據庫教程(視頻指導版)
- SQL Server 2012數據庫管理與開發(慕課版)
- Alfresco for Administrators