I'm wondering what people's opinions are on this vs using multiple classes.
I work mainly in react and use CSS modules and I feel in that context it makes sense. 1 base class and then modify that via data-* attributes.
I think this will also be more powerful when the new attr() functionality hits all browsers and not just chrome.
In React land there is no need for an extra dep to toggle various classes and the JSX looks a lot more readable. Also in the devtools I can then see what "state" my component is in via the data attributes.
I guess I don't really see any downsides but I'm wondering if I'm overlooking something.
As well as data attributes you can use aria attributes to help with accessibility and style based upon that.