question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request : Mat-Tab select by name.

See original GitHub issue

Bug, feature request, or proposal:

Feature Request for material tabs

What is the expected behavior?

The ability to select a tab by its name, like this;

<mat-tab-group [selectedTab]="profile" >

<mat-tab label="Profile" name="profile">

What is the current behavior?

<mat-tab-group [selectedIndex]="4" >

What is the use-case or motivation for changing an existing behavior?

I am using the material tabs in a responsive app. When the app is in mobile size I display 5 tabs, when the app is in desktop size I display 3 tabs. The reason is since there is more room on the desktop I combine the content and show less tabs.

The issue is when I try to link to a specific tab via a URL. I would use a query parameter like ?tabindex=2. However since my tab index changes depending on the application size, the link will work in one case and not the other. So it would be useful to link to the tab by name like this, ?tab=profile. This way I can pass the name to the component and it can figure out the active tab regardless of the index number.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:13
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
AngularAntcommented, Mar 29, 2019

Is there any updates to this feature request?

1reaction
FiringBlankscommented, Aug 17, 2019

This is an important feature. The index of dynamically added tabs by other users means nothing, the name is the appropriate way of selecting a specific tag.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature Request : Mat-Tab select by name. #11858 - GitHub
I am using the material tabs in a responsive app. When the app is in mobile size I display 5 tabs, when the...
Read more >
Angular Material - Know exactly which tab was selected
The feature request is to allow the dev. to set a unique name per tab which can then be read back in the...
Read more >
Making a feature request » MATLAB Community
Click Create New Request under My Support (on the right hand side of the screen). In Step 1: select Technical Support which will...
Read more >
Angular Material mat-tab-group - GeeksforGeeks
Angular Material is a UI component library that is developed by the Angular team to build design components for desktop and mobile web ......
Read more >
Tab group with dynamically changing tabs - StackBlitz
<mat-tab-group [selectedIndex]="selected. value". (selectedIndexChange). ="selected.setValue($event)">. <mat-tab *ngFor="let tab of tabs; let index.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found