Structure: Action or intent required
Menu items needs to know what to do when they are selected. This can done by specifying one of to parameters:
action
- which is a function called with the parameters set for this menu itemintent
- an object containing aname
and an optional bag ofparams
Certain nodes within the desk structure requires a document ID to operate on.
Setting an action or intent can be done by calling the action()
or intent()
methods, respectively:
new MenuItemBuilder()
.title('Open in website')
.icon(OpenIcon)
.params({breed: 'schnauzer'})
.action(params => {
window.open(`https://mywebsite/breeds/${params.breed}`)
})