File
    Implements
    
    
    Metadata
    
        
            
                | selector | mat-fab-menu | 
            
                | styleUrls | mat-fab-menu.component.scss | 
            
                | templateUrl | mat-fab-menu.component.html | 
        
    
    
    Index
    
        
                
                    | Properties | 
                
                    |  | 
                
                    | Methods | 
                
                    |  | 
                
                    | Inputs | 
                
                    |  | 
                
                    | Outputs | 
                
                    |  | 
        
    
    
    
    
        
            
                
                    | closeAfterSelection | 
                
                    | Default value : true | 
                        
                            |  | 
            
        
        
            
                
                    | color | 
                
                    | Type : ThemePalette | 
                
                    | Default value : 'accent' | 
                        
                            |  | 
            
        
        
        
        
        
            
                
                    | icon | 
                
                    | Default value : 'add' | 
                        
                            |  | 
            
        
        
    
    Outputs
        
            
                
                    | onFabMenuItemSelected | 
                
                    | Type : EventEmitter<string | number> | 
                        
                            |  | 
            
        
    
    
    
        Methods
    
    
        
            
                | adjustLayout | 
            
                | adjustLayout() | 
            
                |  | 
            
                |  | 
        
    
    
    
    
    
    
        import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';
import {speedDialFabAnimations} from './mat-fab-menu.animations';
import { ThemePalette } from '@angular/material/core';
import { TooltipPosition } from '@angular/material/tooltip';
export interface MatFabMenu {
  id: string | number;
  icon?: string; // please use either icon or imgUrl
  iconColor?: ThemePalette;
  imgUrl?: string; // please use either icon or imgUrl
  tooltip?: string;
  tooltipPosition?: TooltipPosition;
  color?: ThemePalette;
}
export type MatFabMenuDirection = 'top' | 'bottom' | 'left' | 'right';
@Component({
  selector: 'mat-fab-menu',
  templateUrl: 'mat-fab-menu.component.html',
  styleUrls: ['mat-fab-menu.component.scss'],
  animations: speedDialFabAnimations
})
export class MatFabMenuComponent implements OnInit, OnChanges {
  @Input()
  fabButtons: MatFabMenu[];
  @Input()
  icon = 'add';
  @Input()
  direction: MatFabMenuDirection = 'top';
  @Input()
  color: ThemePalette = 'accent';
  @Input()
  isActive: boolean;
  @Input()
  disabled: boolean;
  @Input()
  closeAfterSelection = true;
  // tslint:disable-next-line:no-output-on-prefix
  @Output()
  onFabMenuItemSelected: EventEmitter<string | number> = new EventEmitter<string | number>();
  layout: any;
  layout2: any;
  constructor() {
  }
  ngOnInit(): void {
    this.adjustLayout();
  }
  ngOnChanges(changes: SimpleChanges): void {
    if (changes.direction && !changes.direction.firstChange) {
      this.direction = changes.direction.currentValue;
      this.adjustLayout();
    }
    if (changes.color && !changes.color.firstChange) {
      this.color = changes.color.currentValue;
    }
    if (changes.fabButtons && !changes.fabButtons.firstChange) {
      this.fabButtons = changes.fabButtons.currentValue;
    }
  }
  adjustLayout() {
    switch (this.direction) {
      case 'top':
        this.layout = 'column-reverse';
        this.layout2 = 'column-reverse';
        break;
      case 'bottom':
        this.layout = 'column';
        this.layout2 = 'column';
        break;
      case 'left':
        this.layout = 'row-reverse';
        this.layout2 = 'row-reverse';
        break;
      case 'right':
        this.layout = 'row';
        this.layout2 = 'row';
        break;
    }
  }
  toggle() {
    this.isActive = !this.isActive;
  }
  selectFabMenu(fab: MatFabMenu) {
    this.onFabMenuItemSelected.emit(fab.id);
    if (this.closeAfterSelection) {
      this.isActive = false;
    }
  }
}
     
    
        <div [fxLayout]="layout" class="container" fxLayoutAlign="center center" fxLayoutGap="16px">
  <div fxLayoutAlign="center">
    <button (click)="isActive = !isActive"
            [color]="color" [disabled]="disabled"
            [ngClass]="{
    'mat-fab' : !isActive,
    'mat-mini-fab' : isActive
  }"
            mat-fab>
      <mat-icon [@fabToggler]="{value: isActive}">{{icon}}</mat-icon> <!-- Animation here -->
    </button>
  </div>
  <div *ngIf="isActive" [@fabsStagger]="fabButtons.length"
       [fxLayout]="layout2" fxLayoutAlign="center center" fxLayoutGap="16px">
    <button (click)="selectFabMenu(fab)"
            *ngFor="let fab of fabButtons"
            [color]="fab?.color"
            [matTooltip]="fab?.tooltip"
            [matTooltipPosition]="fab?.tooltipPosition"
            [ngClass]="{'fullSVG' : fab?.imgUrl}"
            mat-fab>
      <mat-icon *ngIf="fab?.icon" [color]="fab?.iconColor">{{fab?.icon}}</mat-icon>
      <img *ngIf="fab?.imgUrl" [src]="fab?.imgUrl" alt="icon">
    </button>
  </div>
</div>
     
    
                
                :host {
  display: block;
}
.fullSVG {
  img {
    width: 100%;
  }
  ::ng-deep span.mat-button-wrapper {
    padding: 0;
  }
}
.container {
  //position: fixed;
  //bottom: 15px;
  //right: 15px;
  //z-index: 100;
  > div {
    //display: flex;
    //flex-direction: column-reverse;
    //align-items: center;
    margin-bottom: 5px;
    button {
      margin-bottom: 16px;
    }
  }
}
     
    
        
        
            
                Legend
            
            
            
            
                Html element with directive