Member-only story

Angular Material — Form Fields, Grid Lists, and Icons

John Au-Yeung
3 min readJan 19, 2021

--

Photo by Denis Agati on Unsplash

Angular Material is a popular UI framework based on Material Design for Angular.

In this article, we’ll look at how to use Angular Material into our Angular project.

Form Fields

We can add form fields with the MatFormFieldModule .

For example, we can write:

app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatIconModule } from '@angular/material/icon';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
MatFormFieldModule,
MatInputModule,
MatIconModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

app.componen.html

<div>
<mat-form-field appearance="standard">
<mat-label>Standard form field</mat-label>…

--

--

No responses yet