token formatter
A Style Dictionary step that takes all transformed tokens at once and writes them out as one file in a target language.
In more detail
Where a transform changes single tokens, a formatter shapes the whole collection, for example into a :root block of CSS custom properties, a TypeScript module with a typed constant, a Swift file or an Android XML resource. Style Dictionary ships built-in formats and lets you register your own.
Related terms
- Style Dictionary — An open-source build tool that reads design token files and generates code for each platform, such as CSS, TypeScript, Swift and Android resources.
- token transform — A Style Dictionary step that changes one token at a time, such as converting 16px to 1rem or renaming a token to camelCase.
- CSS custom property — A value you name yourself in CSS, such as --color-primary: #2563eb, and use elsewhere with var(--color-primary).
- TypeScript — JavaScript with added type annotations, checked by a compiler before the code runs.
Taught in
- Token Transformation: Style Dictionary & Multi-Platform Outputs — Design Systems & Component Engineering