Page cover image

Asset - Token Type

Asset Tokens define the location of assets to style the fill or stroke of a design element as a URL.

Creating a new Asset Token in the Tokens Studio Plugin for Figma.

Design decisions

Asset Tokens define the location of assets that are stored outside of your Design Tool, and when applied to a 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 Tokens Studio Plugin and the changes will be applied 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 in the dropdown list that are:

  • 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.

For example {token.name.here}

The value will show a broken reference until the originating Token Set is marked as enabled.

Jump to the guide on Token Values with References by selecting the card below to learn more.

Token Values with References

Apply Asset Tokens

You can apply an Asset Token to fill the background of text, polygonal shape, and frame layers in Figma when the Token is applied.

With one or more elements selected in Figma, click on the name of your chosen Asset Token in the Plugin to instantly apply its value.

Once a Token has been applied, it will remain attached until you manually remove it.


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 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, submit it on our feedback tool, or send us an email [email protected]

Requests, roadmap and changelog

  • Asset token enhancements (to include icons) - [Feature Request](# Asset token enhancements)

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

Last updated

Was this helpful?