Skip to content

Design Tokens With Style Dictionary: CSS, iOS, and Android

How Style Dictionary turns Figma design tokens into CSS, iOS, and Android values from one source, plus the DTCG token format and where teams trip up.

· · 5 min read
iMac screen showing a UI component library and design system spec

Design tokens solve a real problem: the same brand blue living as a different hex in three codebases until a rebrand turns into a week of find-and-replace. Style Dictionary is the tool that kills that problem. You define each token once, and it generates the CSS variable, the Swift constant, and the Android resource from a single source. I've migrated a product from hand-copied colors to a token pipeline, and the first rebrand after took twenty minutes instead of three days. That's the whole pitch.

If tokens are new to you, start with the broader picture in the design tokens Figma to code guide. This one goes deeper on the specific tool most teams end up reaching for, and where it fits between Figma and your codebase.

TL;DR: Style Dictionary is an open-source build step that takes your design tokens from one JSON source and generates them for every platform: CSS variables, iOS Swift, Android XML. Figma variables feed it through an export, ideally in the DTCG token format (a W3C Community Group spec, not a ratified W3C standard). The tooling is easy. Naming discipline is what makes or breaks it.

What Does Style Dictionary Actually Do?

Style Dictionary is an open-source build step. Its input is a set of token files, usually JSON. Its output is those same tokens in every format your platforms speak. One color/brand/primary value becomes a CSS custom property for web, a Swift constant for iOS, and an XML resource for Android, all generated, none hand-typed.

The magic word is transforms. A raw token might be #2563eb. A transform can turn that into rgb(), into a Swift UIColor, into an Android @color reference, whatever the target needs. You write the token once and configure how each platform should receive it. Change the source, run the build, and every platform moves together. No drift, no three-way copy-paste.

Colorful syntax-highlighted source code on a computer monitor
Photo by Markus Spiske on Unsplash

Where Does Figma Fit In?

Designers don't write JSON, and they shouldn't have to. Figma variables are where tokens are born. The connection to Style Dictionary is an export step: a plugin like Tokens Studio pushes your variables out to a JSON file, and it runs on any Figma plan. Figma also ships a Variables REST API, but there's a catch worth knowing before you architect around it: that endpoint needs a Full seat in an Enterprise organization, so on Professional or Organization plans it's simply unavailable and the plugin is your path. That file, ideally in the DTCG token format that reached its first stable version (v2025.10) in October 2025, becomes Style Dictionary's input. Worth flagging: this is a W3C Community Group specification, a Community Group Report rather than a ratified W3C standard, so treat it as stable-but-evolving.

So the pipeline reads left to right: a designer edits a variable in Figma, exports to JSON, and Style Dictionary transforms it into platform code. The quality of the output depends entirely on the discipline of the input. Name your Figma variables semantically, color/surface, spacing/md, radius/sm, and the generated code is clean. Name them blue-3-final and you inherit that mess in every codebase. The token structure you build in the step-by-step design system guide is what makes this stage painless.

Here's how one Figma variable lands on each platform once it runs through the build:

Figma variableCSS outputiOS (Swift)Android (XML)
color/brand/primary--color-brand-primaryUIColor constant@color resource
spacing/md--spacing-mdSwift constantdimen resource
radius/sm--radius-smSwift constantdimen resource

One source value, three platform outputs, none of them hand-typed.

Why Get the Token Values Right First?

A pipeline only ships what you feed it, so the values matter as much as the tooling. Your spacing tokens should sit on a consistent scale, not arbitrary numbers, and our free spacing scale generator builds one you can paste straight in. Your type sizes should follow a ratio rather than guesswork, which is what the type scale calculator is for. Feed Style Dictionary a clean, systematic set of values and the output is a system. Feed it a pile of one-off numbers and you've just automated inconsistency.

Rainbow color swatch cards fanned into a color wheel
Photo by Andy Brown on Unsplash

Where Do Teams Trip Up?

Three snags come up again and again.

Modern desk with a monitor, keyboard and drawing tablet
Photo by Jakub Zerdzicki on Unsplash
  • Naming that leaks implementation. Tokens named after their value (blue-500) instead of their role (color-action) can't survive a theme change. Name by intent.
  • Skipping the semantic layer. Reference base tokens through semantic ones, so color-button-bg points at color-brand-primary. Then a rebrand changes one base value and cascades everywhere.
  • Treating the export as one-and-done. Figma variables change. If the export is a manual chore nobody remembers, the code drifts from the design again. Wire the export into a script so it stays honest.

One upside once the pipeline runs: point Style Dictionary at a TypeScript output and every token ships as a typed constant your editor autocompletes. The typed output pays off in daily work, too. Reference a token that doesn't exist and the compiler flags it before the component ever renders, so a renamed color-action-primary can't quietly rot half your buttons. That safety net is exactly why teams bother generating typed tokens instead of loose strings in the first place. Large systems generate thousands of them, and that used to drag type-checking down. Since TypeScript 7 (Project Corsa) reached GA in July 2026, the native Go compiler checks that generated surface roughly 10x faster, so a big token file no longer taxes the build. Coding Dunia's TypeScript 7 guide breaks down what actually changed.

Design tokens are also the cleanest thing you can hand a developer, which is why they sit at the heart of a good designer to developer handoff. Get the tokens right in Figma, let Style Dictionary do the translating, and the gap between what you designed and what ships mostly closes on its own. My take: the tooling is the easy part. The naming discipline is the whole game, and it's the part most teams shortchange.

Frequently Asked Questions

What is Style Dictionary and why use it?
Style Dictionary is an open-source build tool (originally created at Amazon, now maintained together with Tokens Studio) that takes design tokens in a single source file and outputs them in whatever formats your platforms need: CSS custom properties, SCSS variables, iOS Swift, Android XML, JSON, and more. The point is one source of truth. You define color/brand/primary once, and Style Dictionary generates the CSS variable, the Swift constant, and the Android resource from it. Change the token, rebuild, and every platform updates together. Without it, teams hand-copy the same hex into three codebases and drift apart within a sprint.
How do Figma variables connect to Style Dictionary?
Figma variables are where designers define tokens; Style Dictionary is where those tokens become code. The bridge is an export. A plugin like Tokens Studio exports your variables to a JSON file (this works on any Figma plan). There's also a Figma Variables REST API, but heads up: reading or writing variables through it needs a Full seat in an Enterprise org, so most teams on Professional or Organization plans reach for the plugin route instead. That JSON, ideally in the DTCG token format, becomes Style Dictionary's input. So the flow is: designer edits a variable in Figma, exports to JSON, Style Dictionary transforms it into platform code. The cleaner your Figma variable naming, the cleaner the generated output, which is why naming discipline in Figma pays off downstream.
Do I need Style Dictionary for a small project?
Not always. If you ship one web app and nothing else, plain CSS custom properties exported from Figma may be enough, and adding a build pipeline is overhead. Style Dictionary earns its place the moment you have more than one platform, more than one output format, or a token set large enough that hand-syncing becomes error-prone. For a solo web project, start simple. For a design system serving web, iOS, and Android, it saves you from a maintenance nightmare that only gets worse with scale.