Clear Error
Collapse
Expand
Menu Focus Change (Deprecated)
Menu Select (Deprecated)
Menu Trigger Press (Deprecated)
Validation Error (Deprecated)
LWC Developer Guide
SLDS 1
SLDS 2
ui:menuTriggerPress
Deprecated as of API version 47.0. Use lightning:buttonMenu instead.
This event is fired when you click on the ui:menuTriggerLink component. To set a handler for the ui:menuTriggerLink event, use the menuTriggerPress attribute on ui:menuTriggerLink.
The following example shows a menu with two list items. The handleTriggerPress client-side controller action handles the ui:menuTriggerPress event.
1<aura:component>
2 <ui:menu>
3 <ui:menuTriggerLink
4 aura:id="trigger"
5 label="Contacts"
6 menuTriggerPress="{!c.handleTriggerPress}"
7 />
8 <ui:menuList class="actionMenu" aura:id="actionMenu">
9 <ui:actionMenuItem aura:id="item1" label="All Contacts" click="{!c.doSomething}" />
10 <ui:actionMenuItem aura:id="item2" label="All Primary" click="{!c.doSomething}" />
11 </ui:menuList>
12 </ui:menu>
13</aura:component>This client-side controller retrieves the label of the trigger when it’s clicked.
1({
2 handleTriggerPress: function (component, event, helper) {
3 var trigger = component.find("trigger");
4
5 // Get the label on the trigger
6 var triggerLabel = trigger.get("v.label");
7 },
8});If you’re using this event with a component other than ui:menuTriggerLink, register the event first.
1<aura:registerEvent
2 name="menuTriggerPress"
3 type="ui:menuTriggerPress"
4 description="The event fired when the trigger is clicked."
5/>