figma-plugin icon indicating copy to clipboard operation
figma-plugin copied to clipboard

Support "dimension" property type

Open lukasoppermann opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. W3C defines dimension as the type for sizes (https://github.com/design-tokens/community-group/blob/main/technical-reports/format/types.md#dimension). It would be great to support this when importing json files.

Describe the solution you'd like Turn dimension attributes into sizing attributes on import.

lukasoppermann avatar Oct 25 '21 11:10 lukasoppermann

Hello! Thank you for your work on this plugin. Adding the dimension type would be a great feature for me when exporting JSON as well files because dimension types include an explicit unit:

8.2 Dimension Represents an amount of distance in a single dimension in the UI, such as a position, width, height, radius, or thickness. The $type property MUST be set to the string dimension. The value must be a string containing a number (either integer or floating-point) followed by either a "px" or "rem" unit

~ https://second-editors-draft.tr.designtokens.org/format/#dimension

Right now in Figma Tokens JSON exports there are a lot of unitless attributes like fontSizes. Per the Figma tokens documentation the plugin considers any unit-less token as px-based, but this isn't encoded in the output. When processing these tokens in code, it would be useful to have px in the output so we don't need to have a Figma-specific px assumption. Using a standardized dimension type would solve this.

Also if this plugin adds support for some of the newer standardized types like typography and uses fontSize instead of the fontSizes type, this will need to be encoded as a dimension as well.

alecgeatches avatar Jul 20 '22 06:07 alecgeatches

Shipped in 129, its a dedicated token: https://docs.tokens.studio/available-tokens/dimension-tokens

six7 avatar Dec 31 '22 15:12 six7