How to modify PrimeNG’s p-button
, p-inputSwitch
styles if ng::deep
is deprecated?
1
You have to add a class to scope the CSS, then add the styles to the global styles file in the angular project.
SCSS:
.custom-button > button {
background: rgb(46, 82, 33) ;
background: linear-gradient(
90deg,
rgba(46, 82, 33, 1) 22%,
rgba(104, 157, 79, 1) 100%
) ;
}
.custom-switch {
.p-inputswitch .p-inputswitch-slider {
background: black;
}
}
HTML:
<div class="card flex justify-content-center">
<p-button label="Submit" class="custom-button" />
<p-inputSwitch class="custom-switch" />
</div>
Stackblitz Demo