<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-label is similar to labels which we use in normal HTML forms. But the advantage with mat-label is that it has pre-defined CSS style classes and animations defined in it.
ng add @angular/material
- First, install the angular material using the above-mentioned command.
- After completing the installation, Import ‘MatFormFieldModule’ from ‘@angular/material/form-field’ in the app.module.ts file.
- Now we need to use <mat-label> tag with respective label name inside the <mat-form-field> tag.
- Below is an example on how to use <mat-label> tag inside <mat-form-field>
- Once done with the above steps then serve or start the project.
Project Structure: It will look like the following.