Angular 10 : menu example
Angular 10 : menu example
<mat-menu> is a floating panel containing list of options.
By itself, the <mat-menu> element does not render anything. The menu is attached to and opened via application of the matMenuTriggerFor directive:
<button mat-button [matMenuTriggerFor]="menu">Menu</button>
HTML:
<button mat-icon-button [matMenuTriggerFor]="menu" aria-label="Example icon-button with a menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item>
<mat-icon>dialpad</mat-icon>
<span>Redial</span>
</button>
<button mat-menu-item disabled>
<mat-icon>voicemail</mat-icon>
<span>Check voice mail</span>
</button>
<button mat-menu-item>
<mat-icon>notifications_off</mat-icon>
<span>Disable alerts</span>
</button>
</mat-menu>
TS/JavaScript:
import {Component} from '@angular/core';
/**
* @title Menu with icons
*/
@Component({
selector: 'menu-icons-example',
templateUrl: 'menu-icons-example.html',
styleUrls: ['menu-icons-example.css'],
})
export class MenuIconsExample {}
Comments
Post a Comment