Skip to main content

click

Description

fires on clicking a menu bar item or outside the menu bar

Parameters

  • ev - event object
    • context - object for which menu was called, optional
    • action - object of selected menu item, empty if menu was closed by an outside click
    • ev - native html event

Example

<script>
function clicked(ev){
const action = ev.action;
message = action ? `clicked on ${action.id}` : "closed";
}
</script>

<MenuBar {options} onclick={clicked}></MenuBar>

Related article: Catching the change of a clicked option

Related sample: Menu bar