All projects
Figma plugin

Tokens to Code

Export Figma variables to CSS and Tailwind.

Open on Figma Community
Tokens to Code: project interface, view 1
Tokens to Code: project interface, view 2
For whom

Teams moving Figma Variables into frontend code

Scope

Plugin · CSS Custom Properties · Tailwind

Tools

Figma Variables / CSS Custom Properties / Tailwind

The idea

Bring tokens into code, with their themes and references intact.

When moving Figma variables into code, I wanted to preserve their collections, modes, and relationships. I developed Tokens to Code to generate CSS and Tailwind configuration from that structure, with control over naming and an output that can be reviewed before integration.

Modes

Preserve modes in CSS.

I generated one block per mode with :root[data-theme]. The default mode is written to :root, and aliases stay as var() references.

Selection

Control the export scope.

I let users choose collections, modes, and formats, including web Code Syntax or Figma names. Exporting does not alter source variables.

Tokens to Code: Control the export scope., view 1
Tokens to Code: Control the export scope., view 2

Aliases

Preserve token references.

I kept semantic-to-primitive references through var(). External aliases are resolved to values with a comment identifying their origin.

Tailwind

Connect Tailwind to CSS variables.

I made Tailwind configuration reference CSS custom properties to preserve theme switching and opacity modifiers.

Implementation

How I built it.

Validate the full export

I built the generator to traverse collections and modes, resolve aliases, and group values by type. I added warnings for anything that needs review before integrating the output into a project.

Tokens to Code

Export Figma variables to CSS and Tailwind.

Figma Variables
Collections, modes, and aliases.
CSS Custom Properties
One :root block per mode.
Tailwind
theme.extend references CSS variables.
Code Syntax
Web or Figma names, with an optional prefix.
Figma UI3
Offline, local variables only, keyboard accessible.

Figma plugin

The Tailwind output produces theme.extend for tailwind.config.js. This version does not generate Tailwind v4's @theme directive.

Next projectProperties Copycat