File requirements
- The file must be a valid JSON
- It must have the extension
.json
,.json5
,.tokens
, or.tokens.json
- Link to more details
Token set requirements
The token set in your file needs to match the expected structure. Here's a short breakdown of how it should look.Token Group
- A group name is based on the key of the JSON entry.
- Groups can contain the attributes:
-
$type
- a plain string that can be used to infer the purpose of a token- This will also be inherited by any nested groups/tokens that don’t have their own defined type
-
$description
- a plain string that describes the group itself
-
- Groups can be nested any number of times
- Link to more details
Token
- A token name is based on the key of the JSON entry.
- Tokens can contain the attributes:
-
$value
- the value of a token (Required)- The values zh currently fully support are:
- Color
- Defined as
color
- 24bit RGB or 24+8bit RGBA color in the sRGB color space (string)
- Defined as
- Cubic bezier
- Defined as
cubicBezier
- array containing 4 number
[P1x, P1y, P2x, P2y]
(array)
- Defined as
- Dimension
- Defined as
dimension
- Numerical value follow by
px
orrem
(string)
- Defined as
- Duration
- Defined as
duration
- Numerical value followed by
ms
(string)
- Defined as
- Font family
- Defined as
fontFamily
(string)
- Defined as
- Font weight
- Defined as
fontWeight
(string)
- Defined as
- Color
- The values zh currently fully support are:
-
$type
- predefined categorization applied to the token's value -
$description
- which is a plain string that describes the group itself
-
- You can add custom types to a token; this will mean there is no validation on the token's value.
- You can alias a value by putting the full path of another token within curly braces (
{}
) as a token value. E.g.{Color.primary.60}
(Link to more details) - Tokens can be in a group, but not inside other tokens.
- Link to more details
- All reserved words are prefixed with a
$
. This means token and group names cannot begin with a$
as future versions of the spec may introduce new properties. - Current reserved words: type, description, value
- Due to token aliases a token/group name must not use a curly brace
{
,}
, or period.