Angular Material provides Design Components for Angular. This is build and maintained by Angular Team. This provides the Angular developers with common UI components and tools to help build their own custom components. We as a user can integrate this with our Angular Application using the npm packages provided by them.
Angular Material also provides CDK in order to integrate common Interaction patterns.
Lists of Some Components provided is:
- Form Control
- Navigation
- Layout
- Button and Indicators
- Data Table
- Popups
- Modals
STEPS TO ADD MATERIAL COMPONENT TO YOUR APPLICATION
npm install --save angular-material npm install --save @angular/cdk
Note if you want to add any specific version to Angular user the command below :
npm install --save angular-material@version npm install --save @angular/cdk@version
Choose a specific selector for the Material Component.
Go to app.component.html file or another template of the component in which you want to add the Material Component, write the selector code to it.
ng serve
This will reduce your efforts to implement the component right from the base.
EXAMPLE OF ADDING CARD COMPONENT TO YOUR ANGULAR PROJECT:
- Install Angular
- Create a new Angular project using:
ng new GfGMaterialCardExample
- You will be asked 2 questions as shown below:
- Would you like to add Angular routing?
- Which stylesheet format would you like to use? (Use arrow keys)
- Change the directory level, go to the project folder.
cd GfGMaterialCardExample
- Install the Angular Material npm package(@8.0.0 is compatible with Angular 8, Add Angular component based on the Angular Version you are using), Also Install Angular CDK:
npm install --save angular-material@8.0.0 npm install --save @angular/cdk@^8.2.3

- Add the Card Component Import to app.module.ts file as shown below:

- Remove all the Boilerplate Code in
app.component.htmlFile and Add this code:Geeks For Geeks - Angular Material Card Example
- Add the CSS Code you want to apply in app.component.css file:
mat-card { color: green; border:1px solid black; } - Start the Application using ng serve command:

Press Enter Key 2 Times to go with default settings
Recommended Posts:
- How to communicate from parent component to the child component in Angular 9 ?
- How to enable routing and navigation between component pages in Angular 8 ?
- How to Add Google Locations Autocomplete to your Angular Application ?
- Angular 7 | Angular Data Services using Observable
- How to auto-save data when application is offline in Angular 8?
- Routing in Angular JS using Angular UI Router
- Angular CLI | Angular Project Setup
- Difference between Angular 4 and Angular 5
- Angular 8 | Introduction
- Angular 7 | Introduction
- Angular 4 | Introduction
- Angular 7 | Observables
- How to use jQuery in Angular ?
- Angular 7 | Architecture
- Angular 7 | Directives
- Angular 7 | Installation
- Angular 7 | Components
- How to use mat-icon in angular?
- How to use bootstrap 4 in angular 2?
- What is the meaning of let-* in Angular 2 Templates ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

