I want to use the styleClass
property of the Togglebutton
component. As described in another post, I thought it is straight forward by using:
styleClass="test"
In my css-file I then set some attributes, like
.test { background: red; }
But this does not work. Working with style
is perfectly clear by using [style]="{'background':'red'}"
No problem with that. But styleClass
does not work. Here is the component. Any idea how to use styleClass
?
To make things clear: the
styleClass
property is only an addition to the original classes of the component. That means, you always have to use the original classes in order to style the component. WithstyleClass
you then have the possibility to address one or more components of a set of components of the same type. So, having fiveTogglebutton
components, you can generally style those components withIf you then want to style one of those components differently, you can add the
styleClass
property:And in your css you can now address this one by:
Thus
styleClass
is not a replacement for the original selectors, it is an addition.