by defining a cascade of custom properties,
you can determine which
intent
should take priority --
without worrying about the specificity
of how that value is defined.
in this case, my cascade includes:
--btn-bg--state
--btn-bg
--btn-bg--type
--btn-bg--default
Our default button is falling all the way back
to the
--btn-bg--default
defined on
html
.
Adding the
disabled
attribute
always overrides any other button colors --
no matter where they are defined.
We can create button types using
--btn-bg--type
,
and it will override the defaults,
but not the state:
We can also set these values contextually,
rather than directly styling the button.
Values can come from anywhere,
and true specificity only resolves conflicts
between the same custom property.