Quick start
The examples on this page ran on the brand-ab fixture of the repository (test/fixtures/brand-ab): a Primitives collection, a Brand collection with the modes BrandA and BrandB, and ScreenType with Desktop, Tablet and Mobile. The output is copied from those runs.
-
Create a config. In your project folder,
dta initasks which Figma plan you have, which collections and brands to build and which outputs you want, and writes adta.config.ts(dta init --yesasks nothing: it writes the config for exported token files intokens/with every output format, for CI and coding agents). Your outputs becomeoutputs.formats, sodta buildwrites only those; picking CSS and Tailwind v4 gives:dta.config.ts (excerpt, as dta init writes it) outputs: {formats: ['css', 'tailwind-v4'],css: {outDir: 'build/css',},tailwind: {outDir: 'build/tailwind',},},iOS and Android can be picked too: they become
ios-swift,android-xmlandandroid-compose(Native outputs). The fixture’s config builds all four outputs (noformats) and looks like this:dta.config.ts export default {figma: { source: 'file' },tokens: { dir: 'tokens' },brands: ['BrandA', 'BrandB'],breakpoints: {collection: 'ScreenType',default: 'Mobile',modes: { Tablet: '(min-width: 768px)', Desktop: '(min-width: 1024px)' },},outputs: {css: { outDir: 'output/css' },tailwind: { outDir: 'output/tailwind' },},}breakpointsturns theScreenTypemodes into media queries invariables.css;dta initdoes not write it, because the queries are yours to choose (Breakpoint modes). -
Get your tokens. On a Figma Enterprise plan,
dta pullreads the variables through the REST API. On any other plan, export them with a plugin and import the file; see Getting tokens out of Figma. The result is one JSON file per collection and mode intokens/:tokens/Brand(Alias).BrandA.jsonBrand(Alias).BrandB.jsonPrimitives.Value.jsonScreenType.Desktop.jsonScreenType.Mobile.jsonScreenType.Tablet.json -
Build.
$ dta buildT ⚒ dta build|o Base layer complete|o Brand BrandA complete|o Brand BrandB complete|o Shared outputs complete|o Generated files ---------------------------+| || output/css/base.css || output/css/themes/branda.css || output/tailwind/branda/tailwind.tokens.ts || output/tailwind/branda/tailwind.css || output/css/themes/brandb.css || output/tailwind/brandb/tailwind.tokens.ts || output/tailwind/brandb/tailwind.css || output/css/variables.css || output/js/colorpalette.js || output/tailwind/tailwind.tokens.ts || output/tailwind/tailwind.css || |+---------------------------------------------+|— Build complete!What each file is: Outputs.
-
Check the structure. With no rules configured,
dta lintstill catches dangling and circular aliases and Figma’s default mode names. The fixture enables more rules, so it reports warnings:$ dta lint…| Primitives.Value.json|| warn Duplicate value "8" — also defined in: Primitives.Value/Dimensions/spacing/2 [no-duplicate-values]|| 8 warnings found.|— Lint passed with warnings.Warnings exit with 0, errors with 2: Lint rules.
-
See what changed.
dta diffcompares your tokens with a base: a folder, a git ref, or by default the merge base with your main branch.$ dta diff --tokens-only --base tokens-baseT ◑ dta diff|| Base: tokens-basechanged Colors.Brand.Accent Brand(Alias) · BrandB{Colors.Foundation.Navy.700} → #2c4466 → {Colors.Foundation.Sky.500} → #3b8fd9changed Colors.Foundation.Blue.500 Primitives · Value#0047a0 → #0057b8changed Dimensions.spacing.8 Primitives · Value28 → 32added Dimensions.radius.pill Primitives · Value999removed Colors.Foundation.Steel.500 Primitives · Value#7d8ea3affected Colors.Brand.Primary Brand(Alias) · BrandA{Colors.Foundation.Blue.500} → #0047a0 → {Colors.Foundation.Blue.500} → #0057b8 (because of Colors.Foundation.Blue.500)affected Spacing.Padding ScreenType · Desktop{Dimensions.spacing.8} → 28 → {Dimensions.spacing.8} → 32 (because of Dimensions.spacing.8)|— Tokens: 3 changed · 1 added · 1 removed · 2 affectedWith a
diffsection in the config it also screenshots your stories at the base and the head and explains each change by token. -
Review UI changes in pull requests.
dta initsets this up: as the last question of the wizard in a new project, and straight away in a project that already has a config (dta init --diffruns only this step). It finds your Storybook (or asks which pages to check), package manager, Node version and default branch, says where each came from, and writes thediffsection, the GitHub workflow andplaywright-core. On a project with Storybook (--yestakes the detected and default answers):$ dta init --diff --yesT ✨ dta init|o Found|| Storybook build-storybook → storybook-static, from the "build-storybook" script in package.json| Package manager npm, from package-lock.json| Node 22, from .nvmrc| Build npm run build-storybook, from the "build-storybook" script in package.json| Git host GitHub, from the origin remote| Default branch main, from the local branches|o Will write --------------------------------------------+| || build: npx dta build && npm run build-storybook (new) || outDir: storybook-static (new) || stories: Storybook (new) || workflow: split (new) || .github/workflows/dta-diff.yml (new) || .github/workflows/dta-diff-report.yml (new) || .github/workflows/dta-diff-approve.yml (new) || |+---------------------------------------------------------+|* Wrote the diff section of dta.config.json|* Wrote .github/workflows/dta-diff.yml|* Wrote .github/workflows/dta-diff-report.yml|* Wrote .github/workflows/dta-diff-approve.yml|o Ran npm install --save-dev playwright-core|o Next -------------------------------------------+| || npx dta diff --check checks the setup || npx dta diff renders a report locally || Then open a pull request. || |+--------------------------------------------------+|— dta diff is set up.Then check the setup and open a pull request:
$ dta diff --check✓ config diff section: outDir storybook-static, build `npx dta build && npm run build-storybook`✓ browser DTA_BROWSER_PATH (/usr/bin/chromium)✓ git history full history✓ base merge base with main (c320792)✓ stories 1 story in storybook-static/index.jsonReady for dta diff.More in dta diff in pull requests.
Next: Core concepts.