You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Customize Css Class to the Mat-Tab-Content and other Mat-X tags which are generated runtime #23685
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/tabsfeatureLabel used to distinguish feature request from other issues
Found this old issue that has been unresolved closed: #9290.
I want to apply styles to specific mat-tab-bodys but classes on the mat-tab component aren't applied on the mat-tab-body - or actually nowhere; they just get lost.
Yeah, that's right. My problem is: right now I am not able to somehow mark a mat-tab-body depending on it's related mat-tab. In my case I'd like to disable the scrolling behavior (but only for one tab) since the component inside offers it's own.
My current solution is css nth-child ... But ... I'd think you'd agree, that this is no solution 😉
e.g.
<mat-tab class="disable-scroll"> ... </mat-tab>
with Css
.mat-tab-body.disable-scroll { ... } or .mat-tab .disable-scroll .mat-tab-body { ... } - depending on how it get's rendered.
The goal just is to apply styles to mat-tab-body (and it's children) depending on the html's <mat-tab>. Right now the space between the <mat-tab> and the label / body is some kind of blackbox.
You're right, we don't have a good way of doing this at the moment. You might be able to work around it using a lazy-loaded tab and wrapping the content in your own div with a specific class. See https://material.angular.io/components/tabs/overview#lazy-loading.
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/tabsfeatureLabel used to distinguish feature request from other issues
Activity
crisbeto commentedon Oct 5, 2021
Which element are you trying to apply the class on exactly? The
mat-tab-bodyis an internal component that isn't available outside theMatTabModule.angelaki commentedon Oct 5, 2021
Yeah, that's right. My problem is: right now I am not able to somehow mark a
mat-tab-bodydepending on it's relatedmat-tab. In my case I'd like to disable the scrolling behavior (but only for one tab) since the component inside offers it's own.My current solution is
css nth-child... But ... I'd think you'd agree, that this is no solution 😉e.g.
<mat-tab class="disable-scroll"> ... </mat-tab>with Css
.mat-tab-body.disable-scroll { ... }or.mat-tab .disable-scroll .mat-tab-body { ... }- depending on how it get's rendered.The goal just is to apply styles to mat-tab-body (and it's children) depending on the html's
<mat-tab>. Right now the space between the<mat-tab>and the label / body is some kind of blackbox.crisbeto commentedon Oct 5, 2021
You're right, we don't have a good way of doing this at the moment. You might be able to work around it using a lazy-loaded tab and wrapping the content in your own
divwith a specific class. See https://material.angular.io/components/tabs/overview#lazy-loading.angelaki commentedon Oct 5, 2021
It least a good solution for now - thank you!
angelaki commentedon Oct 5, 2021
Sorry, a bit off-topic, but: can recycle of these template be controlled? I'd like to keep them, as soon as they've been created once.
feat(material/tabs): label & body classes
feat(material/tabs): label & body classes
feat(material/tabs): label & body classes
feat(material/tabs): label & body classes
feat(material/tabs): label & body classes
feat(material/tabs): label & body classes
feat(material/tabs): label & body classes
feat(material/tabs): label & body classes
feat(material/tabs): label & body classes
feat(material/tabs): label & body classes (#23691)
angular-automatic-lock-bot commentedon Feb 15, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
feat(material/tabs): label & body classes (angular#23691)