Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Change mdb-tab heading color only for certain tabset

1001albertpadilla free asked 5 years ago


Is it possible to change the mdb-tab heading only for certain tabsets?

<mdb-tabset #staticTabs [buttonClass]="'nav md-pills pills-default'" [contentClass]="'card'" [justified]="false" class="p-0 m-0">
  <mdb-tab heading="Main">

I want to change the heading font color only for this tabset. Is that possible?


Bartosz Termena staff answered 5 years ago


Dear @1001albertpadilla

you can do it this way:

TS

 @ViewChild('staticTabs', { static: true }) staticTabs: TabsetComponent;

  constructor(private renderer: Renderer2) {}
  ngAfterViewInit() {
    this.renderer.addClass(
      this.staticTabs.itemsList.nativeElement.querySelectorAll('li')[0].querySelector('span'),
      'font-class'
    );
  }

styles.scss

.font-class {
  color: blue;
}

Hope it helps!

Best Regards, Bartosz.


1001albertpadilla free commented 5 years ago

The color change works. Is it possible to have a blue color for the selected tab while a red color for the inactive ones?


1001albertpadilla free commented 5 years ago

I got this solved.

.md-pills .nav-link { color: blue !important; } .md-pills .nav-link.active { color: white !important; }

Thanks!



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.5.3
  • Device: Laptop
  • Browser: Chrome
  • OS: Win 10
  • Provided sample code: No
  • Provided link: No