Token Types
Asset

Asset Token

The Asset Token captures the location of images, icons, and other visual content within your design system as a Token.

Design decisions defined by Asset Tokens

When you define your assets as Design Tokens, it becomes easier to maintain consistency across several design elements where the asset appears.

When the Asset Token is applied to a compatible design element, the asset will fill the layer.

For example, a product photo across several pages on a marketing website.

When it comes time to change your assets, you can update the Asset Token in the plugin and apply the changes across your entire design system with just a couple of clicks.

Possible Values

An Asset Token can reference any URL or path to an asset file, such as:

  • URLs pointing to images or icons hosted online.
  • Local file paths if working within a local environment.

The image source needs to have its own CORS (Cross-Origin Resource Sharing) validation.

  • Some websites already have that implemented (e.g. Unsplash).
  • You can put your images behind a CORS proxy if needed.

→ More information on CORS can be found here.

Values that reference another Token

When trying to reference another Token as the Value for an Asset Token, you will see

  • Tokens living in Token Sets that are currently active.
    • In the left menu on the plugin's Tokens page, a checkmark is visible next to the Token Set name.
  • Token Type is compatible:
    • The same = asset

However, like all token types, you can "force" a reference by manually entering the token name between curly brackets.

The value will show a broken reference until the originating token set is marked as enabled.

Jump to the Token Values with References guide for more details

W3C DTCG Token Format

Asset is not yet an official Token Type in the W3C DTCG specifications, but there is mention of a 'File' Token Type under consideration (8.8 Additional Types)

Transforming Tokens

Engineers typically transform Tokens used in code with Style Dictionary, which is tool-agnostic. Tokens coming from Tokens Studio require an additional step: @Tokens-studio/sd-transforms, an npm package that prepares Tokens for Style Dictionary.

When transforming Asset Tokens, there are no specific configurations to be aware of. Running the SD-Transforms pre-processor as part of the generic package will prep your Asset Tokens for Style Dictionary.

SD-Transforms Read-Me Doc, Using the preprocessor

Resources

Mentioned in this doc:

Figma resources:

CSS resources:

Community resources:

  • Katie Cooper(www.katiecooper.co) demo's Asset Tokens during the How to Leverage Tokens Studio to level up your Design System presentation - YouTube

💡 Something to share? Submit it here!

Known issues and bugs

Tokens Studio Plugin GitHub - Open issues for Token Type Asset

🐞 If you are experiencing an issue not listed here, please reach out to us on the Troubleshooting channel of our community Slack, or submit it on our feedback tool.

Requests, roadmap and changelog

💌 Visit https://feedback.tokens.studio/ to contribute or subscribe to updates.

Last updated on September 9, 2024