Is it possible to define design tokens that are similar to Figma’s Text Styles? That is, the tokens represent a set of CSS properties rather than an individual property. Specifically we’d like to expose a value like “Headline level 2” that determines the fontFamily, fontSize, lineHeight, etc.
Currently design tokens map to specific values, like color or fontName. I would recommend using custom CSS classes to achieve styling multiple properties at once.
There’s another post saying the typography.headings
property can be used to modify the text styles in the editor using the design tokens. However, when I try this the entire typography section disappears from the Builder UI without any errors.
export const designTokens = {
colors: [
{ name: 'PrimaryText', value: '#333333' },
{ name: 'SecondaryText', value: '#666666' },
],
typography: {
headings: {
h1: {
fontSize: '32px',
color: 'var(--colors-primaryText)',
},
h2: {
fontSize: '28px',
color: 'var(--colors-secondaryText)',
},
},
},
};
Is this valid? It’s difficult to find out what can and can’t be used as the docs are pretty sparse and there aren’t any TypeScript types for the tokens.