Context menu
Overview
The dropdown menu button for executing different actions, for example, app navigation. The component supports both manual and dynamic options configuration, as well as various positioning, adjustment, appearance, and styling options.

Properties
name
string
Component name
Methods
click
event?: any
void
Trigger click event
setDisabled
disabled: boolean
void
Disable or enable the component
setMenuItems
items: { id: string; title?: string; icon?: string; onlyIcon?: boolean }[]
void
Set menu options for component
open
–
void
Open the menu
close
–
void
Close the menu
toggle
–
void
Toggle the menu
Triggers
On Click
Triggered when the component is clicked
On Item Click
Triggered when a menu item is clicked
On Init
Triggered when the component is initialized
Working with the component
Triggering unique actions based on the selected menu item
UI Bakery allows you to set up unique actions for each selected menu item in the Context menu component. Here's how you can do that:
Select the Context menu component and set up its menu items. Make sure each one has a unique id, for example, item_1, item_2, item_3, etc.
Create your unique actions that you want to be triggered for each item.
Next, create another action of the JavaScript Code type to trigger specific actions depending on the selected item:
if ({{params.id}} === 'item_1') {
await {{actions.itemOneClick.trigger()}};
} else if ({{params.id}} === 'item_2') {
await {{actions.itemTwoClick.trigger()}};
} else if ({{params.id}} === 'item_3') {
await {{actions.itemThreeClick.trigger()}};
}
Assign this action to the component's On Item Click trigger.

When clicking on a menu item, the unique action will be triggered and the {{params.id}}
variable will contain the value of the selected item id.
Last updated
Was this helpful?