In Stitches, a Token represents a design system value (like a color or spacing value) that can be serialized into a CSS custom property (variable).
Each token contains:
token: The name of the token.value: The raw value (number or string).scale: The category/scale the token belongs to (e.g., 'colors', 'space').prefix: An optional prefix for the CSS variable.variable: The fully serialized CSS custom property name (e.g., --prefix-scale-token).computedValue: The CSS var() representation of the token.
Tokens can be converted to their CSS variable string representation using .toString().
// Conceptual representation of a Token object
const myToken: Token = {
token: 'primary',
value: '#000',
scale: 'colors',
prefix: 'app',
variable: '--app-colors-primary',
computedValue: 'var(--app-colors-primary)',
toString: () => 'var(--app-colors-primary)'
};