MenuLitComponent is an application menu component implemented as a LitElement.
- Submenus
- Shortcut text
- Property driven
- Intuitive mouse events
- Disabled menu items
- Written with TypeScript
To experiment with the MenuLitElement component.
-
Clone this repo.
-
Install the dependencies with npm:
npm install
- Install the Polymer Cli:
npm install -g polymer-cli
- Serve the project from the root directory with the Polymer Cli:
polymer serve
- Update the menu items in the constructor of the menu-lit-element.ts file
this.rootMenu = [
{
text: 'File', menu: [
{ text: 'New File', shortCutText: 'Ctrl+Shift+N' },
...
To use the MenuLitElement component in your code:
- Install MenuLitElement from Npm
npm install --save menu-lit-element.
- Import MenuLitElement in JavaScript (or TypeScript):
import { MenuLitElement} 'menu-lit-element';
- Add the menu-lit-element tag in html:
<menu-lit-element></menu-lit-element>
- The intent of this project was to learn LitElement by creating a real world web component. MenuLitElement is not production complete.
- Submenus in submenus are not supported.
- MenuLitElement is based on the application menu in mxGraph and the accompanying Graph Editor example application.
- The project structure is based on the PolymerLabs LitElement starter project