p-tabPanel headerStyleClass

UI Components for Angular
Post Reply
HorseBadorties
Posts: 3
Joined: 10 Oct 2018, 09:55

22 Nov 2018, 14:01

Setting the headerStyleClass property of a p-tabPanel has no effect - what am I missing?

Here's the Stackblitz showing the problem.

Code: Select all

<p-tabView>
	<p-tabPanel header="First" headerStyleClass="redText">
		<span class="redText">tab text should have been red, too...</span>   
	</p-tabPanel>
	<p-tabPanel header="Second">
		Second
	</p-tabPanel>
	<p-tabPanel header="Third">
		Third
	</p-tabPanel>
</p-tabView>

Code: Select all

.redText {
  color: red;
}

suhail1k4
Posts: 2
Joined: 01 Apr 2020, 16:59

02 Apr 2020, 16:55

i think there is an encapsulation problem here . They have already defined styling for p-tabPanel header and you can't override that with important because of shadowDom concept. There is a fix with that in component add encapsulation like this @Component({
.... ,

encapsulation: ViewEncapsulation.None
})
add add headerStyle or headerStyleClass like you are doing .

.redText a {
property: value
} as you need to add style to content of <a> </a>

However i think there should be a better way of fixing this as it can impact other components if same class if used there . See more on shadowConcept
Thanks

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests