Structured Content 2022: Join our conference to explore fresh perspectives on content and digital experiences →

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 item
  • intent - an object containing a name and an optional bag of params

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}`)
  })

Was this article helpful?