Skip to main content

How to declare a variant on component root element but style a sub-element?

.component.variantThe selector you want to insert .elementThe element you want to style
+component('.btn')
+register
+variant('.primary')
+element('.icon')

display: inline-flex

+___________________
+element('.icon')
+default
background-color: grey

+variant('.primary')
background-color: red





.btn {
display: inline-flex;
}

.btn .icon {
background-color: grey;
}

.btn.primary .icon {
background-color: red;
}

More info: +state, +default, +element, +register, +component, separator +___