Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Defining and Using Tokens
Defining Tokens
1<aura:tokens>
2 <aura:token name="myBodyTextFontFace"
3 value="'Salesforce Sans', Helvetica, Arial, sans-serif"/>
4 <aura:token name="myBodyTextFontWeight" value="normal"/>
5 <aura:token name="myBackgroundColor" value="#f4f6f9"/>
6 <aura:token name="myDefaultMargin" value="6px"/>
7</aura:tokens>The only allowed attributes for the <aura:token> tag are name and value.
Using Tokens
1.THIS p {
2 font-family: token(myBodyTextFontFace);
3 font-weight: token(myBodyTextFontWeight);
4}If you prefer a more concise function name for referencing tokens, you can use the t() function instead of token(). The two are equivalent. If your token names follow a naming convention or are sufficiently descriptive, the use of the more terse function name won’t affect the clarity of your CSS styles.