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?
Asked
Active
Viewed 5,825 times
1 Answers
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
-
This would only work with angular version>=7 since it was introduced after that. – Utkarsh May 29 '20 at 14:01
-
Thank you. I was not paying attention to providers and was wondering why it is not working. – Gopal Mishra Feb 28 '22 at 16:30