Skip to content
Marc Espín Sanz edited this page Jun 23, 2020 · 3 revisions

The Menu constructor refers to the dropmenus you see in the toolbar that you see on top. The constructor only takes one object as argument.

Simple example:

new Menu({
  button:'My menu',
  list:[
    {
      label:'Option 1',
      action(){
        console.log('Clicked option 1')
      }
    },
    {
      label:'Option 2',
      action(){
        console.log('Clicked option 2')
      }
    }
  ]
})

Now with a submenu:

new Menu({
  button:'My menu',
  list:[
    {
      label:'My options',
      list:[
        {
          label:'Option 1',
          action(){
            console.log('Clicked option 1')
          }
        },
        {
          label:'Option 2',
          action(){
            console.log('Clicked option 2')
          }
        }
      ]
    }
  ]
})
  • button: refers to the button text showed in the toolbar
  • list: an ordered list of the dropmenu you see when you click the button
    • label: text of the button
    • action: function executed on the button's click.

Documentation

Tutorials

Contributing

About

Clone this wiki locally