Table

mat-table is a flexible data table component with sorting and pagination.

Basic Table

mat-table displaying periodic elements with static data.

No.NameWeightSymbol
1Hydrogen1.0079H
2Helium4.0026He
3Lithium6.941Li
4Beryllium9.0122Be
5Boron10.811B
6Carbon12.0107C
7Nitrogen14.0067N
8Oxygen15.9994O
9Fluorine18.9984F
10Neon20.1797Ne
<table mat-table [dataSource]="dataSource" class="w-full">
  <ng-container matColumnDef="position">
    <th mat-header-cell *matHeaderCellDef>No.</th>
    <td mat-cell *matCellDef="let e">{{ e.position }}</td>
  </ng-container>
  <ng-container matColumnDef="name">
    <th mat-header-cell *matHeaderCellDef>Name</th>
    <td mat-cell *matCellDef="let e">{{ e.name }}</td>
  </ng-container>
  <ng-container matColumnDef="weight">
    <th mat-header-cell *matHeaderCellDef>Weight</th>
    <td mat-cell *matCellDef="let e">{{ e.weight }}</td>
  </ng-container>
  <ng-container matColumnDef="symbol">
    <th mat-header-cell *matHeaderCellDef>Symbol</th>
    <td mat-cell *matCellDef="let e">{{ e.symbol }}</td>
  </ng-container>
  <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
  <tr mat-row *matRowDef="let r; columns: displayedColumns;"></tr>
</table>

Sortable & Paginated Table

mat-table with matSort and mat-paginator for interactive sorting and page navigation.

No.
Name
Weight
Symbol
1Hydrogen1.0079H
2Helium4.0026He
3Lithium6.941Li
4Beryllium9.0122Be
5Boron10.811B
6Carbon12.0107C
7Nitrogen14.0067N
8Oxygen15.9994O
9Fluorine18.9984F
10Neon20.1797Ne
0 of 0
<table mat-table [dataSource]="dataSource" matSort class="w-full">
  <ng-container matColumnDef="position">
    <th mat-header-cell *matHeaderCellDef mat-sort-header>No.</th>
    <td mat-cell *matCellDef="let e">{{ e.position }}</td>
  </ng-container>
  <!-- ... additional columns ... -->
  <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
  <tr mat-row *matRowDef="let r; columns: displayedColumns;"></tr>
</table>
<mat-paginator
  [pageSizeOptions]="[5, 10]"
  [showFirstLastButtons]="true"
  aria-label="Table paginator"
></mat-paginator>