not allow mat-step to go next or back if form not valid code example Example: If 'mat-step' is an Angular component, import {MatStepperModule} from '@angular/material/stepper';