Angular Material Multi Step Form Example

By Hardik Savani October 20, 2023 Category : Angular

In this tutorial, we will discuss angular material multi step form. if you have question about angular material multi step reactive form then i will give simple example with solution. this example will help you how to create multi step form in angular material. you will learn multi step form angular material example.

In this example, we will use angular material stepper to create multi step form in angular application. you can easily use this example with angular 9, angular 8, angular 7 and angular 6.

we will create simple page for create product and we will add three step there. in first step we will add basic details, second step has stock and amount and last step we will create review page. we will use reactive form form creating multi step form using angular material.

So, let's follow bellow step to create multi step form in angular.

Step 1: Create New App

If you are doing example from scratch then You can easily create your angular app using bellow command:

ng new newMat

Step 2: Add Material Design

Now in this step, we need to just install material design theme in our angular application. so let's add as like bellow:

ng add @angular/material

Cmd like bellow:

Installing packages for tooling via npm.

Installed packages for tooling via npm.

? Choose a prebuilt theme name, or "custom" for a custom theme: Indigo/Pink

[ Preview: ]

? Set up global Angular Material typography styles? Yes

? Set up browser animations for Angular Material? Yes

Step 3: Import Module

Here, we will simply import FormsModule, ReactiveFormsModule, MatStepperModule, MatInputModule, MatButtonModule, MatListModule and BrowserAnimationsModule module for creating very simple example. so let's import on module.ts file.


import { BrowserModule } from '@angular/platform-browser';

import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import {FormsModule, ReactiveFormsModule} from '@angular/forms';

import {MatStepperModule} from '@angular/material/stepper';

import {MatInputModule} from '@angular/material/input';

import {MatButtonModule} from '@angular/material/button';

import {MatListModule} from '@angular/material/list';


declarations: [



imports: [










providers: [],

bootstrap: [AppComponent]


export class AppModule { }

Step 4: Update ts file

in this step, we need to update ts file as like bellow:


import { Component } from '@angular/core';

import {FormBuilder, FormGroup, Validators} from '@angular/forms';


selector: 'app-root',

templateUrl: './app.component.html',

styleUrls: ['./app.component.css']


export class AppComponent {

title = 'newMat';

isLinear = true;

firstFormGroup: FormGroup;

secondFormGroup: FormGroup;

constructor(private _formBuilder: FormBuilder) {}

ngOnInit() {

this.firstFormGroup ={

name: ['', Validators.required],

description: ['', Validators.required]


this.secondFormGroup ={

amount: ['', Validators.required],

stock: ['', Validators.required]








Step 5: Update html file

in this step, we need to update html file as like bellow:


<h1>Angular Multi Step Form Example -</h1>

<h3>Create Product</h3>

<mat-horizontal-stepper [linear]="isLinear" #stepper>

<mat-step [stepControl]="firstFormGroup">

<form [formGroup]="firstFormGroup">

<ng-template matStepLabel>Basic Details</ng-template>



<input matInput placeholder="Name" formControlName="name" required>





<textarea matInput placeholder="Description" formControlName="description" required>




<button mat-button matStepperNext>Next</button>




<mat-step [stepControl]="secondFormGroup">

<form [formGroup]="secondFormGroup">

<ng-template matStepLabel>Amount & Stock</ng-template>



<input matInput placeholder="Amount" formControlName="amount" required>





<input matInput placeholder="Stock" formControlName="stock" required>




<button mat-button matStepperPrevious>Back</button>

<button mat-button matStepperNext>Next</button>





<ng-template matStepLabel>Done</ng-template>

<p>You are now done.</p>


<mat-list-item> <strong>Name:</strong> {{ }}</mat-list-item>

<mat-list-item> <strong>Description:</strong> {{ this.firstFormGroup.value.description }}</mat-list-item>

<mat-list-item> <strong>Amount:</strong> {{ this.secondFormGroup.value.amount }}</mat-list-item>

<mat-list-item> <strong>Stock:</strong> {{ this.secondFormGroup.value.stock }}</mat-list-item>



<button mat-button matStepperPrevious>Back</button>

<button mat-button (click)="stepper.reset()">Reset</button>

<button mat-button (click)="submit()">Submit</button>




Now you can run by bellow command:

ng serve

you can see bellow layout.

I hope it can help you...