How to use <mat-divider> 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-divider> tag is used to separate two sections or content with a horizontal line.
ng add @angular/material
- First, install the angular material using the above-mentioned command.
- After completing the installation, Import ‘MatDividerModule’ from ‘@angular/material/divider’ in the app.module.ts file.
- After importing the ‘MatDividerModule’ we need to use <mat-divider> tag.
- When we use <mat-divider>, a horizontal grey line is rendered on the screen.
- The main purpose of this tag is to separate any two-block, div, or any sections.
- Once done with the above steps then serve or start the project.
Project Structure: It will look like the following.