A menu UI element, with items that can be selected.
$ component install segmentio/menu
For quick, standard menus, treat it as a constructor:
varMenu=require('menu');varmenu=newMenu().add('One').add('Two').add('Three');menu.select('Three');Or, for more complex menus, you can use it as a factory, passing in your own MenuItem view.
varMenuItem=require('./menu-item'),createMenu=require('menu');varMenu=createMenu(MenuItem);varmenu=newMenu().add('One').add('Two').add('Three');menu.select('Three');Initialize a new Menu the default item view:
<liclass="menu-item {slug}-menu-item"><a>{text || id}</a></li>Create a new Menu constructor with the given Item view.
Add an item to the menu with either a model or an id string. The default item view uses the model's text and/or id field to populate it's DOM.
Select a menu item.
Deselect all menu items.
MIT