23.02.2026 ... A complete example of an Angular Material Data Table with server-side pagination, sorting, filtering, as well as a loading indicator....
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.
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:

ng new mat-table-example
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 { } ```
For this example, let's use a simple array of objects as our data source. In your component.ts file, define your data:

```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 ]; ```
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; } ```
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; } ```
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!
<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>
<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>
<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>
<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>
<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>
<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>
<strong>Angular Material UI component library</strong><p>UI component infrastructure and Material Design components for mobile and desktop Angular web applications.</p>
<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>
<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>
<strong>Angular Material</strong><p></p>
<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>
<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>
<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>
<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>
<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>
<strong>Table - Angular Material UI component library</strong><p>UI component infrastructure and Material Design components for mobile and desktop Angular web applications.</p>
<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>
<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>
<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>
<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>