A Menu Button is always associated with a Menu component that contains a list of Menu Items. When a Menu button is clicked, the associated Menu Items will be shown.
A Menu button is used to provide an interface for the user to trigger a Menu List. Menu appears where the menu button exists.
- After creating a Menu, drag and drop the Menu Button component to the desired position and enter a value for the
MenuName
attribute. - Set the
matMenuTriggerFor
attribute to the same value as thematMenu
attribute of the Menu component. - Save the changes and run the page.
- Create a page called Neutrinos Home Page.
- Drag and drop the Menu component.
- Set the
matMenu
attribute to menu. - Drag and drop three Menu Item components inside the Menu component.
- Set the
MenuItemName
attribute of menu items to item1, item2, and item3. - Drag and drop the Menu Button component to the desired position and set
MenuName
attribute to Menu andmatMenuTriggerFor
attribute to menu. - Save the changes and run the page.
- When the page is rendered, clicking the Menu button will reveal the list of menu items as item1, item2, and item3.
- Style: It accepts a string value and affects different properties such as height, width, and color of the component based on the values provided. For example:
background:orange;height:200px;
. - Class: Used to point to a class in a style sheet. A class contains one or more style statements. Classes are created in the Styles editor by clicking Styles in the editor menu. The
class
attribute accepts space separated class names which are defined as shown below: -
.class1 { border-radius:10px; flex-basis:10%; height:100px; } .class2 { border-radius:10px; flex-basis:10%; height:100px; }
- MenuName: Specify the name of the menu button to appear in the application. It accepts String values.
- Color: A drop-down list which accepts the color based on the angular material theme. You can choose between the following colors, or click the edit button to input the color of your choice:
- Primary
- Accent
- Warn
- [matMenuTriggerFor]: Used to reference the menu instance that the trigger is associated with. This value should have the same value as the **
matMenu
**attribute of the associated Menu component. This field accepts String values.
- Devices: Android, iOS
- Browsers: Latest version of all modern browsers
- Dependencies version:
- Angular CLI version: 6.0.0 +
- Cordova version: 7.1.0 +