4

The Lightning [developer guide][1] is not very helpful on how to use Design tokens:

Tokens created in the defaultTokens bundle are automatically available in components in your namespace.

Ok, and what if I want to rename it or if another one is already using it? How would I then access them different from:

.THIS p {
    font-family: token(myBodyTextFontFace);
    font-weight: token(myBodyTextFontWeight);
}
  • Documentation doesn't say if we can create another token file. I think we cannot have more than one token file. Hope i am proved wrong – RedDevil Jun 18 '18 at 14:22
3

You can create custom tokens, but you cannot reference your custom tokens directly in your lightning component. If you want to create custom token other than Default token then you need to maintain a hierarchical structure of other tokens. Default token will be the parent and all others child and sub-child and so on. To extend Tokens in the parent token use the keyword “extends”.

I would suggest you look into the below link for more info on how to use custom tokens.

Use Tokens in salesforce Lightning

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.