Open In App

<mat-progress-bar> in Angular Material

Introduction:

Angular Material is a UI component library that is developed by the Angular team to build design components for desktop and mobile web applications. In order to install it, we need to have angular installed in our project, once you have it you can enter the below command and can download it. <mat-progress-bar> tag is used for displaying the progress bar. Progress bars are used to indicate the status of a particular task.



Installation syntax:

ng add @angular/material

Approach:



Code Implementation:

app.module.ts:




import { CommonModule } from '@angular/common'
import { NgModule } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { MatProgressBarModule } from '@angular/material'
    
import { AppComponent } from './example.component'
    
@NgModule({ 
  declarations: [AppComponent], 
  exports: [AppComponent], 
  imports: [ 
    CommonModule, 
    FormsModule, 
    MatProgressBarModule
  
  ], 
}) 
export class AppModule {}

app.component.html:




<h4> Progress Bars with primary theme </h4>
  
<mat-progress-bar mode="determinate" 
    value="40"></mat-progress-bar>
<br><br><br>
  
<mat-progress-bar mode="buffer" 
    value="40"></mat-progress-bar>
<br><br><br>
  
<mat-progress-bar mode="indeterminate" 
    value="40"></mat-progress-bar>
  
<h4> Progress Bars with warn theme </h4>
<mat-progress-bar mode="determinate" 
    value="40" color="warn"></mat-progress-bar>
<br><br><br>
  
<mat-progress-bar mode="buffer" value="40" 
    color="warn"></mat-progress-bar>
<br><br><br>
  
<mat-progress-bar mode="indeterminate" 
    value="40" color="warn"></mat-progress-bar>
<br><br><br>
  
<h4> Progress Bars with accent theme </h4>
  
<mat-progress-bar mode="determinate" value="40"
        color="accent"></mat-progress-bar>
<br><br><br>
  
<mat-progress-bar mode="buffer" value="40" 
    color="accent"></mat-progress-bar>
<br><br><br>
  
<mat-progress-bar mode="indeterminate" 
    value="40" color="accent"></mat-progress-bar>

Output:

 


Article Tags :