Angular Material Tabs how to customize tab row and add text or dropdown list?

大城市里の小女人 提交于 2021-01-29 12:34:27

问题


I am currently using angular material tabs and I wish to add text before the tabs and also add a drop down list at the end of the row after the tabs. Ideally it should looks something like the following picture:

sample

I tried putting a label or creating a div beside the tabs, however those are not showing. In the end, I created another tab and set it to disabled but I think this is not ideal and I couldn't change the disabled text colour. As for the drop down list I have no clue how to go about it.

I have a demo on stackblitz HERE

How do I customize the tab row and add text or dropdown list in it?


回答1:


You could use absolute position to achieve what you want. You won't be able to do better than this because the component you are using mat-tab-group does not have the option to pass a component in input to display where you want.

So if you want to show something inside mat-tab-group that is not part of mat-tab-group, you have to use absolute position.

I updated your stackblitz here

Note: your disabled Tab trick is very good also, it's a trick but sometimes you have to do some tricks



来源:https://stackoverflow.com/questions/58519190/angular-material-tabs-how-to-customize-tab-row-and-add-text-or-dropdown-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!