Token API
token-config()
mixin
Adds tokens to the design system. Must be used in a valid CSS selector.
There are two parameters to this mixin. The first one is to insert a pre-made token map. It could be from the design team, or from the project's UX lead. Then the second one is for adding your own tokens.
Both parameters can be used simultaneously, or if you don't want that you can always use one or the other.
Syntax
Usage
token-check()
function
Checks if a token is a valid token or not. Must be used within a valid SCSS conditional statement.
NOTE: It does not throw and error when the value is asserted as false, you need to make the error yourself.
Syntax
Usage
token-create()
mixin
Creates a token. Must be used within a valid CSS selector.
This is the smallest and the most basic mixin for this API. This is where all the individual tokens gets passed and made into a design token available for querying.
Syntax
Usage
token-get()
function
Queries and retrieves a token in its CSS custom property form. Must be used as a property value, css-function value, or key-fallback value.
Allows you to query your own tokens and pass it off inside a property to be used.
Syntax
Usage
token-get-raw()
function
Queries and retrieves a token in its raw value form. Must be used as a property value, css-function value, or key-fallback value.
Allows you to query your own tokens and pass it off inside a property to be used.
This is especially useful when using the sass version of the rgba()
function.
Syntax
Usage
token-switch()
function
Queries a token; if it is a token it returns the token, if not it returns the value as is. Must be used as a property value, css-function value, or key-fallback value.
This is especially useful when creating your styling API.
Syntax
Usage
token-switch-raw()
function
Queries a token; if it is a token it returns the token in its raw value form, if not it returns the value as is. Must be used as a property value, css-function value, or key-fallback value.
This is especially useful when creating your styling API.