๐Ÿงฎ Math in token value enhancements

Today we can use math to create some very sophisticated token setups, but there are some limitations the community would like to have addressed:

Referencing Tokens in our math equations that have values that contain units can lead to unexpected results.

  • This is because the math package we use can resolve equations with units, as long as the units aren't mixed.

  • For example, if we have:

    • a Token named size-2 with a value of 1.5rem

    • a Token named density-default with a value of 2px

    • When we include both Tokens in a math equation written as: {size-2} + {density-default}

    • The equation can't be resolved because the Tokens we are referencing contain a mix of rem and pixel units.

  • If both Tokens have the same units, or are unitless, the equation would resolve as expected.


If a token has multiple values (spacing token with 4, 8), and it's used in a math equation, it breaks the function and it can't be resolved.

  • This means, any token with more than one value can't be referenced in tokens using math.

This forces token structure changes to workaround the limitation.

  • This issue isn't obvious to the person writing the token as there is a lack of specific error messages to help them self solve.

๐Ÿ’ฌ Feedback that is valuable

  • How does this issue impact your day-to-day workflow?

  • What workarounds do you have?

Please authenticate to join the conversation.

Upvoters
Status

๐Ÿ’ก Requests

Board

๐Ÿ’ก Plugin Feedback

Tags

Token Values

Date

Almost 2 years ago

Author

Sam - Tokens Studio

Subscribe to post

Get notified by email when there are changes.