Angular Mat-Table Example: Master Dynamic Data Tables

23.02.2026 ... A complete example of an Angular Material Data Table with server-side pagination, sorting, filtering, as well as a loading indicator....

Mastering MatTable in Angular: A Comprehensive Example

In the realm of web development, Angular's Material Design components offer a rich set of UI elements, with MatTable being a standout among them. MatTable is a powerful data display component that allows you to present tabular data in an engaging and interactive way. Let's dive into a comprehensive example of using MatTable in an Angular application.

Setting Up the Environment

Before we begin, ensure you have Angular CLI installed. If not, install it using npm:

npm install -g @angular/cli

Then, create a new project:

Creating a Simple table in Angular using mat-table

ng new mat-table-example

Installing Angular Material

Navigate into your new project directory and install Angular Material:

cd mat-table-example
npm install --save @angular/material @angular/cdk @angular/animations

Import the required modules in your AppModule:

```typescript import { NgModule } from '@angular/core'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { MatTableModule } from '@angular/material/table'; @NgModule({ imports: [ BrowserAnimationsModule, MatTableModule ] }) export class AppModule { } ```

Creating the Data Source

For this example, let's use a simple array of objects as our data source. In your component.ts file, define your data:

How To Add Click Event On Mat-Row In Angular Material Table – SLEQJZ

```typescript export interface PeriodicElement { name: string; position: number; weight: number; symbol: string; } const ELEMENT_DATA: PeriodicElement[] = [ {position: 1, name: 'Hydrogen', weight: 1.0079, symbol: 'H'}, {position: 2, name: 'Helium', weight: 4.0026, symbol: 'He'}, // ... more elements ]; ```

Building the Table

In your component.html file, create the MatTable:

```html

No. {{element.position}} Name {{element.name}} Weight {{element.weight}} Symbol {{element.symbol}}
```

Don't forget to set the dataSource and displayedColumns in your component.ts:

```typescript import { Component } from '@angular/core'; import { PeriodicElement } from './periodic-element'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { displayedColumns: string[] = ['position', 'name', 'weight', 'symbol']; dataSource = ELEMENT_DATA; } ```

Styling the Table

You can style your table using CSS. In your component.css file, add:

```css table { width: 100%; border-collapse: collapse; } th, td { padding: 8px; text-align: left; border-bottom: 1px solid #ddd; } ```

Conclusion

That's it! You now have a fully functional MatTable in your Angular application. With this example, you can build upon and create more complex tables with features like sorting, pagination, and filtering. Happy coding!

Reference Info

<strong>Angular Material Data Table: A Complete Example</strong><p>23.02.2026 ... A complete example of an Angular Material Data Table with server-side pagination, sorting, filtering, as well as a loading indicator.</p>

Creating a Simple table in Angular using mat-table
Creating a Simple table in Angular using mat-tableSource: N/A
Reference Info

<strong>Simple Angular mat-table example - StackBlitz</strong><p>Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.</p>

How To Add Click Event On Mat-Row In Angular Material Table – SLEQJZ
How To Add Click Event On Mat-Row In Angular Material Table – SLEQJZSource: N/A
Reference Info

<strong>Angular Material table — complete example | by Sri M - Medium</strong><p>08.03.2020 ... In this article, let's explore the features of angular mat-table. I will start with basic table and start adding the following features to it.</p>

Angular Material Table Example| Angular Mat Table Example ...
Angular Material Table Example| Angular Mat Table Example ...Source: N/A
Reference Info

<strong>Angular Material Table Tutorial with API Data - YouTube</strong><p>25.09.2021 ... Comments · Add Filtering and Sorting using angular pipes · Introduction to Angular: Tour of Heroes · Angular Material Data Table Tutorial · APIs for ...</p>

Nested Mat-Table Example at Claire Ryder blog
Nested Mat-Table Example at Claire Ryder blogSource: N/A
Reference Info

<strong>Angular Material - How to display data with the loop in the mat-table</strong><p>26.09.2024 ... Create each MatTableDataSource instance for each element in the filteredSizeCode array. Copy. datasources: MatTableDataSource<any[]>[] = []; ...</p>

Angular Material Table (mat-table) Tutorial with Examples: Pagination ...
Angular Material Table (mat-table) Tutorial with Examples: Pagination ...Source: N/A
Reference Info

<strong>Angular Material Table: A Complete Guide with Best Example</strong><p>25.06.2024 ... We'll dive into Angular Material tables in this blog article, covering various table kinds, creating and customizing them, and implementing advanced features ...</p>

Angular Material Table (mat-table) Tutorial with Examples: Pagination ...
Angular Material Table (mat-table) Tutorial with Examples: Pagination ...Source: N/A
Reference Info

<strong>Angular Material UI component library</strong><p>UI component infrastructure and Material Design components for mobile and desktop Angular web applications.</p>

Angular Material Mat Table Vertical Scroll Example - ItSolutionstuff.com
Angular Material Mat Table Vertical Scroll Example - ItSolutionstuff.comSource: N/A
Reference Info

<strong>components/src/material/table/table.md at main - GitHub</strong><p>To simplify the use case of having a table that can sort, paginate, and filter an array of data, the Angular Material library comes with a MatTableDataSource ...</p>

Mat Table Angular Install at Jason Lindstrom blog
Mat Table Angular Install at Jason Lindstrom blogSource: N/A
Reference Info

<strong>Understanding Angular Material Table Inputs - DEV Community</strong><p>02.10.2019 ... Directive mat-table has a dataSource input which can be an array, an Observable array, or a DataSource instance. A <table mat-table [dataSource] ...</p>

Angular Material Table (mat-table) Tutorial with Examples: Pagination ...
Angular Material Table (mat-table) Tutorial with Examples: Pagination ...Source: N/A
Reference Info

<strong>Angular Material</strong><p></p>

Material Angular Table : How to present Object object in a table using ...
Material Angular Table : How to present Object object in a table using ...Source: N/A
Reference Info

<strong>Editable Angular Material Table with filtering, sorting and paging</strong><p>07.11.2024 ... Get Alexander Gremzo's stories in your inbox ; ng-container matColumnDef="price"> ; th mat-header-cell *matHeaderCellDef mat-sort-header> ; th> ; td ...</p>

Angular Material Table (mat-table) Tutorial with Examples: Pagination ...
Angular Material Table (mat-table) Tutorial with Examples: Pagination ...Source: N/A
Reference Info

<strong>How to use Angular Mat-table? - Reddit</strong><p>25.10.2020 ... For example,. They have <table mat-table [dataSource]="dataSource" matSort> when declaring the table. What would this [ ...</p>

Angular Material Table, Filtering, Sorting, Paging - Code Maze
Angular Material Table, Filtering, Sorting, Paging - Code MazeSource: N/A
Reference Info

<strong>Angular Material Table Tutorial with API Data - YouTube</strong><p>20.11.2022 ... ... table builds on the foundation of the CDK data-table and uses a similar interface for its data input and template, except that its element ...</p>

Angular 11 - Angular Material Datatable Working Example - Therichpost
Angular 11 - Angular Material Datatable Working Example - TherichpostSource: N/A
Reference Info

<strong>Creating a Dynamic View and Material Table in Angular - Medium</strong><p>07.03.2020 ... MatTable Template · Get Tristan Holaday's stories in your inbox · Fetching Sources · Set Service and Fetch Data · VOILA! · Written by Tristan Holaday.</p>

mat-table example in angular 8 - usmtechworld
mat-table example in angular 8 - usmtechworldSource: N/A
Reference Info

<strong>Angular Mat Table Render Rows - StackBlitz</strong><p>import { Component, ViewChild } from · '@angular/core'; · import { MatTableDataSource, MatTable } from · '@angular/material'; · /** · * @title Table with filtering.</p>

Angular Material Data Table - Mat-Table Example
Angular Material Data Table - Mat-Table ExampleSource: N/A
Reference Info

<strong>Table - Angular Material UI component library</strong><p>UI component infrastructure and Material Design components for mobile and desktop Angular web applications.</p>

Mat Table Angular Install at Jason Lindstrom blog
Mat Table Angular Install at Jason Lindstrom blogSource: N/A
Reference Info

<strong>create a material looking table (withOUT dataTable) #3805 - GitHub</strong><p>27.03.2017 ... Ok, I have a solution to handle html table without data source in official angular material. It's easy to use. Just rebuild the dom generated ...</p>

How To Get Mat Table Index at Gerard Martin blog
How To Get Mat Table Index at Gerard Martin blogSource: N/A
Reference Info

<strong>Data Table with MatTableModule - YouTube</strong><p>28.10.2025 ... Comments ; Table Pagination with MatPaginator. OOP Coders · 215 views ; Angular Material Table - With Sorting and API Data. Monsterlessons Academy ...</p>

Mat Table Angular Install at Jason Lindstrom blog
Mat Table Angular Install at Jason Lindstrom blogSource: N/A
Reference Info

<strong>Reusable Angular Material Table in Angular 20 | by Andreea Magdici</strong><p>21.07.2025 ... In the parent component, we will define the template of the custom cells that we want to display in a particular location inside our generic ...</p>

10 Best Angular DataTables with Pagination, Sorting and filter feature
10 Best Angular DataTables with Pagination, Sorting and filter featureSource: N/A
Reference Info

<strong>Angular Material Table - GeeksforGeeks</strong><p>23.07.2025 ... Angular Material is a UI component library for Angular to build customizable, responsive, and visually appealing web applications.</p>

Mat Table Angular Install at Jason Lindstrom blog
Mat Table Angular Install at Jason Lindstrom blogSource: N/A
Load Site Average 0,422 sec