Replies: 4 comments 2 replies
-
Here are some follow-up questions:
|
Beta Was this translation helpful? Give feedback.
2 replies
-
I included the jsonschema example. I used the yaml format to support comments. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Also, this does bring us in closer alignment with the w3c spec for shadow tokens. Example: {
"shadow-token": {
"$type": "shadow",
"$value": {
"color": "#00000088",
"offsetX": "0.5rem",
"offsetY": "0.5rem",
"blur": "1.5rem",
"spread": "0rem"
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks for the feedback. I'm closing this discussion for now. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem statement
Drop shadow definitions include several values that don't need to be stored as separate values with separate names since they should always be used as a single shadow. This can make it complicated for implementations, products, and designers to know how to use the parts of the drop shadows together.
History
Drop shadows are stored as a combination of tokens:
drop-shadow-x
,drop-shadow-y
,drop-shadow-blur
, anddrop-shadow-color
.In Spectrum 2, the proposed design will use more drop shadows for different elevation and state conditions and create the shadows by layering multiple drop shadows (CodePen example). Adding more drop shadows for different use cases and composed of several parts will further exasperate the complexity described in the problem statement above.
Future
If we use complex tokens similar to those used in Tokens Studio for Figma, we would be able to combine all the shadow parts into a single token with a single token name.
Alternatives considered
The only alternative we considered or found would be to create new tokens for each new shadow and part.
Decisions
We've decided to start with simpler shadows to reduce complexity and unblock S2 work while we research and establish a path forward for using complex tokens.
Example JSON Schema
I've written an example definition of the JSON schema we could use in the token system.
Consequences or Required Actions
Implementations will need to update their parsers to handle these new complex drop-shadow tokens. CSS custom properties support defining a shadow in a single custom property
--shadow-part-1: 0px 2px 8px 0px rgba(0, 0, 0, 0.08);
.There are some unknowns and potential downsides introduced by trying to reference tokens inside and outside these complex object values. It seems that Tokens Studio for Figma supports using references inside the complex token definition like this:
but it doesn't seem possible to reference individual parts of that complex token or do things like extend existing shadows. This means we would need to use aliases to share the parts of the shadows that have the same values for the same reasons (e.g., shadow color, etc).
Beta Was this translation helpful? Give feedback.
All reactions