Material table should be responsive
See original GitHub issueBug, feature request, or proposal:
Can not set the table to be responsive.
What is the expected behavior?
I have a default columns list by using *matHeaderRowDef parameter. like:
<mat-header-row *matHeaderRowDef="defaultColumns"></mat-header-row>
I need to set another columns list to display for smartphone. This expected columns list should be different to the default columns list and trigged automatically on smartphone.
What is the current behavior?
I didn’t find any example, can you help me please?
What are the steps to reproduce?
Providing a StackBlitz reproduction is the best way to share your issue.
StackBlitz starter: https://goo.gl/wwnhMV
What is the use-case or motivation for changing an existing behavior?
I need something like this for Angular 5 for the company use: https://codepen.io/zavoloklom/pen/IGkDz
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 5 Material latest version
Is there anything else we should know?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Material Table is not responsive · Issue #1395 - GitHub
Material Table is not responsive. It only reduces the width of the table when shrinking a page. A lot of other table libraries...
Read more >How to make an Angular Material table responsive
I created a little directive which can be applied to a mat-table table to make it responsive. This way it is easy to...
Read more >Angular Material Table Responsive - StackBlitz
Starter project for Angular apps that exports to the Angular CLI.
Read more >Responsive table using Angular Material
In this article, we discuss how to easily implement a responsive table with pagination using Angular Material. Here we have use mat-table, ...
Read more >Table | Angular Material
The mat-table provides a Material Design styled data-table that can be used to display rows of data. This table builds on the foundation...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Duplicate of #8494
@pierre03 Here’s a comment I made on that issue that may help guide you into creating a responsive table. https://github.com/angular/material2/issues/8494#issuecomment-359607760
In that example, I used the same columns. However, if you want to change the columns based on the screen size, try using the CDK’s breakpoint observer.
Here’s a quick example showing this: https://stackblitz.com/edit/angular-mohmt5-y88uhq?file=app%2Ftable-basic-example.ts
An alternative is to use responsive bootstrap tables, see here
For example :