Skip to content

Add uniqueName to MatTab in Tabs #13921

@IgorWolbers

Description

@IgorWolbers

Feature request

Add uniqueName to mat-tab in Tabs

What is the expected behavior?

  • Add the ability to specify a uniqueName per mat-tab in Tabs as an Input() or programmatically using MatTab
  • Add the uniqueName property to MatTab anywhere this is accessible including MatTabChangeEvent.tab.uniqueName for all @Output events that are of type EventEmitter<MatTabChangeEvent>

What is the current behavior?

This is currently not available.

What are the steps to reproduce?

Nothing to reproduce, not currently available.

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

The only way to see which tab was activated/changed in a handler for selectedTabChange is to use the event tab's index. If the developer wants to execute a specific action per activated tab like preloading data (as one example) the system must be able to identify exactly which tab was selected. This can be cumbersome for multiple reasons.

  • If tabs are dynamically hidden from view using *ngIf conditions the tab's index assignments shift making it difficult to know which tab was activated unless the event handler also checks all the conditions.
  • If the UI changes and the tabs are re-ordered (as a part of a design change) the event handler must also be updated so that any logic based on selected tab is also updated to reflect the new UI order.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular CLI: 7.0.3
Node: 10.13.0
OS: win32 x64
Angular: 7.0.1
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        7.0.3
@angular/cdk                      7.0.2
@angular/cli                      7.0.3
@angular/material                 7.0.2
@ngtools/webpack                  6.0.8
@schematics/angular               7.0.3
@schematics/update                0.10.3
rxjs                              6.3.3
typescript                        3.1.3
webpack                           4.8.3

Is there anything else we should know?

I might have forgotten an additional point of where you can set or read back the value. I wrote this based on the documentation, please use your own judgment and add it in any necessary additional locations if deemed appropriate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P5The team acknowledges the request but does not plan to address it, it remains open for discussionarea: material/tabsfeatureThis issue represents a new feature or feature request rather than a bug or bug fixhelp wantedThe team would appreciate a PR from the community to address this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions