1

I want to create an Angular Material stepper, but instead of a number inside the bubble I want to use mat-icons, how should I do this?

Devin Andres Salemi
  • 2,198
  • 3
  • 12
  • 25

1 Answers1

7

You can use matStepperIcon to override the icon.

<mat-horizontal-stepper>
  <mat-step label="Step 1" state="minus">
    <p>Minus</p>
    <div>
      <button mat-button matStepperNext>Next</button>
    </div>
  </mat-step>
  <mat-step label="Step 2" state="plus">
    <p>Plus</p>
    <div>
      <button mat-button matStepperNext>Next</button>
    </div>
  </mat-step>

  <ng-template matStepperIcon="minus">
    <mat-icon>remove</mat-icon>
  </ng-template>
  <ng-template matStepperIcon="plus">
    <mat-icon>add</mat-icon>
  </ng-template>
</mat-horizontal-stepper>

Add to the component:

providers: [{
  provide: STEPPER_GLOBAL_OPTIONS, useValue: {displayDefaultIndicatorType: false}
}]
Vlad Gincher
  • 1,052
  • 11
  • 20