How to declare a component state on sub-element?
.component .elementThe element you want to style:activeThe selector you want to insert
- SASS
+component('.btn')
+register
+element('.icon')
+state(':active')
display: inline-flex
+___________________
+element('.icon')
+default
background-color: grey
+state(':active')
background-color: red
- CSS
.btn {
display: inline-flex;
}
.btn .icon {
background-color: grey;
}
.btn .icon:active {
background-color: red;
}
More info: +state, +default, +pseudo-element, +element, +register, +component, separator +___