matBadge in angular-material Last Updated : 19 Jan, 2021 Comments Improve Suggest changes Like Article Like Report 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. The main use of the matBadge and assign a value in order to display numbers or status over text or images or icons. We can relate to them as a notification icon number indicator. Installation syntax: ng add @angular/material Approach: First, install the angular material using the above-mentioned command.After completing the installation, Import ‘MatBadgeModule’ from ‘@angular/material/badge’ in the app.module.ts file.Then use matBadge and assign a number to display it over any text or image.We also have other properties like matBadgeOverlap and matBadgeSize in-order to customizes the badge size and position.If we want to change the theme then we can change it by using the matBadgeColor property. In angular we have 3 themes, they are primary, accent, and warn.Once done with the above steps then serve or start the project. Code Implementation: app.module.ts: JavaScript import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { AppComponent } from './app.component'; import { MatBadgeModule} from '@angular/material/badge'; import { MatIconModule} from '@angular/material/icon'; import { MatButtonModule} from '@angular/material/button'; @NgModule({ imports: [ BrowserModule, FormsModule, MatButtonModule, MatBadgeModule, MatIconModule ], declarations: [ AppComponent ], bootstrap: [ AppComponent ] }) export class AppModule { } app.component.html: HTML <h3> Mat-Badge over a text</h3> <p> <span matBadge="8" matBadgeOverlap="false"> Text with a badge </span> </p> <hr> <h3> Mat-Badge positioned left and right over a Button </h3> <p> <button mat-raised-button color="primary" matBadge="8" matBadgePosition="before" matBadgeColor="accent"> Left badge Button with accent theme </button> </p> <p> <button mat-raised-button color="accent" matBadge="8" matBadgePosition="after" matBadgeColor="primary"> Right badge button with primary theme </button> </p> <hr> <h3> Mat-Badge over a icon</h3> <p> <mat-icon matBadge="8" matBadgeColor="warn"> home </mat-icon> </p> Output: Comment More infoAdvertise with us Next Article in Angular Material B bunnyram19 Follow Improve Article Tags : Web Technologies AngularJS AngularJS-Misc Material-UI Similar Reads Angular Material List Angular Material is a UI component library developed by Google so that Angular developers can develop modern applications in a structured and responsive way. By making use of this library, we can greatly increase the user experience of an end-user thereby gaining popularity for our application. This 4 min read Angular Material Icons Angular Material is a UI component library that is developed by Google so that Angular developers can develop modern applications in a structured and responsive way. By using this library, we can significantly increase an end-users user experience, thereby gaining popularity for our application. Thi 5 min read <mat-list> 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 downloa 2 min read Angular Material Installation Angular Material is a popular UI framework for building user interfaces with the Material Design style, widely used by web developers around the world. It is a set of reusable UI components and guidelines for building web applications with the Material Design language, which is developed by Google. 5 min read <mat-menu> in Angular Material 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. The 2 min read <mat-label> in Angular Material 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-lab 2 min read Like