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-chip-list is used mainly for labels.
ng add @angular/material
- First, install the angular material using the above-mentioned command.
- After completing the installation, Import ‘MatChipsModule’ from ‘@angular/material/chips’ in the app.module.ts file.
- Then use the <mat-chip-list> tag to group all the labels or items inside this group tag.
- Inside the <mat-chip-list> tag we need to use <mat-chip> tag for every item or labels.
- In Angular material, we also have a chip-list type called stack chip-list where all the chips or labels are displayed vertically like a stack.
- In order to display in such a form, we need to use this class name “mat-chip-list-stacked”.
- If we want to change the theme then we can change it by using the color 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.
Project Structure: It will look like the following.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.