<mat-card> 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.
ng add @angular/material
<mat-card> is a content container that can be used for inserting text, photos, and actions in the context of the subject.
In Angular Material <mat-card> has many properties that we can use to build simple cards. These properties can be easily integrated, and we can code cards in an easier way. The below table has all the properties that are present in an elaborative way.
|Description of the Element|
|Title of the respective card|
|The subtitle of the respective card|
|All the data and information which is the body of the card needs to be written in this section.|
|This tag is used to mention all the events like submit, cancel and etc|
to be written in the card.
|It is used to mention all the details on the header of the card like title, subtitle etc.|
- First, install the angular material using the above-mentioned command.
- After completing the installation, Import ‘MatCardModule’ from ‘@angular/material/card’ in the app.module.ts file.
- Now use the above tags mentioned in the table and code a card.
- Make sure that every tag is present within the opening(<mat-card>) and closing(</mat-card>) tags.
- If you are using <mat-button> then make sure that you are importing ‘MatButtonModule’ too.
- Once done with the above steps then start the project.