Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show Angular Material Tabs in two (2) rows

I am building a tabs component using Angular Material Tabs and as the number of tabs increase, it automatically starts scrolling horizontally. Instead of doing that, I want to break the tabs and show them in two (2) rows. How do I do this?

You can find the code here: StackBlitz

Please help me get this done.

like image 923
Shafkhan Avatar asked May 08 '26 00:05

Shafkhan


1 Answers

By default .mat-tab-labels has display:flex if you want to show all tabs in two lines or more you can use display: block.

So you can solve this problem by css like this:

::ng-deep .mat-tab-labels {
  /* display: flex; */ default display is flex change to block
  display: block !important;
}

ForkedStackblitz

And the result:

enter image description here

like image 104
Alireza Ahmadi Avatar answered May 11 '26 16:05

Alireza Ahmadi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!