Open In App

<mat-list> in Angular Material

Introduction:
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-list> tag is used to display the list of items or records.

Installation syntax:



ng add @angular/material

Approach:

Code Implementation:
app.module.ts:






import { CommonModule } from '@angular/common'
import { NgModule } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { MatListModule } from '@angular/material'
    
import { AppComponent } from './example.component'
    
@NgModule({ 
  declarations: [AppComponent], 
  exports: [AppComponent], 
  imports: [ 
    CommonModule, 
    FormsModule, 
    MatListModule
  
  ], 
}) 
export class AppModule {}

app.component.html:




<mat-list role="list">
  <mat-list-item role="listitem">HTML</mat-list-item>
  <mat-list-item role="listitem">CSS</mat-list-item>
  <mat-list-item role="listitem">Javascript</mat-list-item>
</mat-list>

Output:
 

 

 


Article Tags :