Add conditional properties to Stencil via modifiers and values #2941
NicholasBoll
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We combined modifiers and variables to provide flexibility in Stencils to support hard-coded modifier values as well as dynamic input:
But there's a problem. What if you do not want to define
padding
if not provided to the Stencil. According to the CSS custom property specification, thevar()
will always return a value. This means thepadding
property is always defined, even if the value is invalid. If thevar(--padding)
is not defined, it will returnunset
. Ifpadding
was defined elsewhere (maybe we're extending a Stencil), we've overridden the padding!What if we could define a fall through so that we don't need to define
padding
in thebase
styles?Now if
padding
is not provided to the Stencil, thepadding
style property will not be defined and will not override any other styles that already definepadding
Beta Was this translation helpful? Give feedback.
All reactions