Theme: Add Figma scopes to element size tokens#79032
Conversation
Add `com.figma.scopes` of `WIDTH_HEIGHT` to the `wpds-dimension.size` tokens so they can be imported into Figma and offered when sizing layers, matching the existing `surface-width` tokens. Co-authored-by: Cursor <[email protected]>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Document the WIDTH_HEIGHT Figma scopes added to --wpds-dimension-size-* tokens in #79032. Co-authored-by: Cursor <[email protected]>
|
Aside: We should document how we're using Figma scopes in these token source files. At the very least it would be a useful resource to point to https://developers.figma.com/docs/plugins/api/VariableScope/ as the reference of what's available. |
Follow-up: #79157 |
Follow up to #76545.
What
Adds
com.figma.scopesofWIDTH_HEIGHTto thewpds-dimension.size.*element size tokens (5xsthroughlg) inpackages/theme/tokens/dimension.json.Why
Without a Figma scope defined as an
$extensionsentry, these tokens aren't surfaced as size options in Figma's variable pickers when designers are sizing layers.Adding the
WIDTH_HEIGHTscope makes them importable and selectable in the appropriate context, consistent with how the existingsurface-widthtokens are scoped.How
$extensionsblock with"com.figma.scopes": [ "WIDTH_HEIGHT" ]to each of the eightsizetokens, mirroring the established pattern already used bysurface-width.Testing Instructions
packages/theme/tokens/dimension.jsoninto Figma.wpds-dimension/size/*variables import with theWIDTH_HEIGHTscope applied.sizetokens are offered in the variable picker.Note
Unfortunately Figma's scoping system doesn't support targeting height or width individually, only both together, so despite it not matching their intended purpose it will be possible to assign size tokens to widths in Figma.