Token Architectures: Keeping Figma and React in Sync

By Subhani Shaik · Feb 4, 2026 · 3 min read

Design systems often break at handoff. A colour changes in Figma, but the code keeps the old hex value. A clear token structure, plus a little automation, closes that gap.

Use three tiers of tokens

Three layers keep tokens from sprawling:

/* 1. Primitives: raw values only */
--color-orange-500: #FF6B35;

/* 2. Semantic aliases: named for their job */
--accent-primary: var(--color-orange-500);

/* 3. Component tokens: scoped to one component */
--button-primary-bg: var(--accent-primary);

With this structure, a theme change means editing primitives and aliases, not hunting through components. This portfolio itself uses semantic tokens such as --accent-primary and --text-secondary.

Automate the export

One practical setup:

  1. The Figma library is published.
  2. A script reads the variable collections through Figma’s API.
  3. It converts them to CSS variables, and to types if the code uses TypeScript.
  4. It opens a pull request for engineers to review.

Designers keep ownership of the values; engineers keep control of what merges.

Catch hard-coded values

Automation only helps if people use the tokens. A lint rule that flags hard-coded hex colours and pixel values during code review, such as #FF6B35 where var(--accent-primary) belongs, keeps drift from creeping back in.

Put it into practice, step by step

To set this up on an existing product, this is the order I would follow:

  1. Audit the values you already have. List every colour, spacing value, radius and font size used in Figma and in the code. Merge near-duplicates, such as three slightly different oranges, before you name anything.
  2. Create primitives in Figma. Make a variable collection called Primitives that holds raw values only, such as orange/500 = #FF6B35. Never use these directly on a component.
  3. Add semantic aliases. Make a second collection whose variables point at primitives, such as accent/primary → orange/500. Add Light and Dark modes here, so a theme change touches only this layer.
  4. Add component tokens only where needed. Create a component token when a component makes its own decision, such as button/primary-bg. If it would just repeat an alias, use the alias.
  5. Mirror the names in code. Use the same names as CSS variables, so accent/primary in Figma becomes --accent-primary in code. Matching names make reviews and search easy.
  6. Automate the export. On plans that include Figma’s Variables REST API, a script can read the collections and write tokens.css. Otherwise a token plugin or a JSON export does the same job. Either way, open a pull request rather than pushing straight to the main branch.
  7. Block hard-coded values. Add a lint rule, for example Stylelint’s color-no-hex, and run it in CI, so a pull request with a raw #FF6B35 fails with a pointer to the right token.
A design system isn’t only a Figma library. It’s the link between design decisions and production code.

Key takeaways

Subhani Shaik, Senior Product Designer