Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular material separate md-tabs body

I'm using angular material (https://material.angularjs.org/)

Is there a way to separate a tabs body from the tab list? I couldn't find any mention of this in the documentation.

Currently I have something like this, I need to move md-tab-body outside of md-tabs. Preferably without use of states or controller show/hide logic.

<md-tabs>
<md-tab>
    <md-tab-label>First tab</md-tab-label>
    <md-tab-body>
        <p>First tabs content.</p>
    </md-tab-body>
</md-tab>
<md-tab>
    <md-tab-label>Second tab</md-tab-label>
    <md-tab-body>
        <p>Second tabs content.</p>
    </md-tab-body>
</md-tab>

like image 295
Coloured Panda Avatar asked Jan 28 '26 06:01

Coloured Panda


1 Answers

This isn't currently possible, but there may be different solutions depending on your use-case.

Option 1

The md-tab-body is optional, so you can use md-tabs to only handle the tab bar, and manually handle your tab content elsewhere, bound to the same selected index used by md-tabs.

Option 2

A lot of people want this functionality so that the tab bar can be a part of md-toolbar. This can be achieved by putting the md-tabs element directly after the md-toolbar, as demonstrated here: http://codepen.io/robertmesserle/pen/LVxzNW

like image 102
Robert Messerle Avatar answered Jan 29 '26 20:01

Robert Messerle



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!