[Tabs] Ability to hide tabs header
See original GitHub issueBug, feature request, or proposal:
Feature request
What is the expected behavior?
The mat-tab-group should expose a property using which the header can be hidden. Setting the property to true should hide the header of the mat-tab-group.
What is the current behavior?
At the moment. in order to hide the header, I have to override the default styles of the class “.mat-tab-header” and set the display property to none along with setting component’s encapsulation to encapsulation: ViewEncapsulation.None. Given below is an example how I am currently hiding the tab header:
CSS Styles
.header-less-tabs.mat-tab-group .mat-tab-header {
display: none;
}
TypeScript
import { Component, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ],
encapsulation: ViewEncapsulation.None
})
export class AppComponent {
}
Html Template
<mat-tab-group class="header-less-tabs">
<mat-tab label="Tab 1">Content 1</mat-tab>
<mat-tab label="Tab 2">Content 2</mat-tab>
</mat-tab-group>
What are the steps to reproduce?
Here is a link to StackBlitz Demo of what I am looking to achieve.
What is the use-case or motivation for changing an existing behavior?
I have an app where I am loading different contents/sections inside the mat-tab-group, and I am using a sidebar with the buttons to navigate. Also, the navigation happens from inside any tab. I do not have any routes in the app, so using “mat-tab-nav-bar” is not an option.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:48
- Comments:16 (1 by maintainers)
Top Related StackOverflow Question
I would very much like this feature too.
I have a list of products categories and only some have sub categories. I am displaying the products in a sub category in a tab control, but when there is only a single sub category I don’t want to display the tab control header. Would be much simpler template if I had this property.
Really wish some of these ‘low priority’ tasks that should be simple to implement could be prioritized more highly 😕