No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
Menus
A menu is a drop-down list with a trigger that controls its visibility. You must provide the trigger and list of menu items. The dropdown menu and its menu items are hidden by default. You can change this by setting the visible attribute on the ui:menuList component to true. The menu items are shown only when you click the ui:menuTriggerLink component.
This example creates a menu with several items.
1<ui:menu>
2 <ui:menuTriggerLink aura:id="trigger" label="Opportunity Status"/>
3 <ui:menuList class="actionMenu" aura:id="actionMenu">
4 <ui:actionMenuItem aura:id="item2" label="Open" click="{!c.updateTriggerLabel}"/>
5 <ui:actionMenuItem aura:id="item3" label="Closed" click="{!c.updateTriggerLabel}"/>
6 <ui:actionMenuItem aura:id="item4" label="Closed Won" click="{!c.updateTriggerLabel}"/>
7 </ui:menuList>
8</ui:menu>You can display a list of items from an object. This example displays a list of contact names in a menu using aura:iteration.
1<aura:component>
2 <aura:attribute name="contacts" type="String[]" default="All,Primary,Secondary"/>
3 <ui:menu>
4 <ui:menuTriggerLink label="Select Contact"/>
5 <ui:menuList>
6 <aura:iteration var="contact" items="{!v.contacts}">
7 <ui:actionMenuItem label="{!contact}"/>
8 </aura:iteration>
9 </ui:menuList>
10 </ui:menu>
11</aura:component>The following components are nested in ui:menu.