Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Modifier classes are ambiguous #2915
In USWDS 2.0 we've started using an additive technique for styling variants of base components. For example, if you want a button with the secondary color as its background:
We feel good that this is a positive change that makes style composition clearer, more modular, and more reliable. For instance, there's now no need to remember if
What's ambiguous is when a particular class is a modifier variant or a base class itself. When do you need to add the base class and a variant and when do you need just a single class?
I propose that variant modifier classes should be separated by a double hyphen (
The double hyphen is relatively simple to type, is consistent with an existing convention, and provides an important distinction. Is this something we should do for USWDS 2.0 to accompany our switch to modular classing? Would this help developers better understand the necessary classes?
I'm game to consider BEM though I do currently consider it overkill. It'll take a little longer to fully rewrite everything in BEM and I'm not sure if it sets some expectation that our codebase may not always deliver! But the upside could be just as you say.