<mat-slider> 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-slider> tag is used whenever there is a need for a slider in our projects.
ng add @angular/material
- First, install the angular material using the above-mentioned command.
- After completing the installation, Import ‘MatSliderModule’ from ‘@angular/material/slider’ in the app.module.ts file.
- Then use the mat-slider tag to display the slider.
- They are many properties in <mat-slider> which helps us in using it in different scenarios.
- Some important properties are explained in below table.
- 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.
- By default, the accent theme is set.
- Once done with the above steps then serve or start the project.
|invert||In order to display the slider in an inverted direction.|
|vertical||In order to display the slider in a vertical direction.|
|disabled||In order to disable the slider|