A tokens library turns Figma variables and styles into files in your repository: DTCG, JSON, CSS custom properties, SCSS, TypeScript and JavaScript with type declarations. This page covers the settings that shape those files and shows what the generated output looks like.
Before you start
- Figma is connected to your workspace, and the file is visible to that connection.
- A repository is connected to the project. See Connect a repository.
- Styles sync on their own. Variables need a Figma Enterprise plan or the FISYCO plugin, which sends them from inside Figma. See FISYCO plugin for Figma.
- You're a maintainer of the project, or a workspace owner or admin.
Create the library
- Open the project, click Add library, choose Tokens and click Continue.
- General. Name the library and paste the link to the Figma file.
- Sync method. Choose Styles automatically, variables via the plugin, or Variables from Figma if your Figma plan opens the variables API.
- Styles. All style groups start selected. Clear the ones you don't need.
- Variables. Pick the variable groups to sync. Skip this step if styles are enough.
- Generation. Set the Repository folder (
src/tokensby default), the formats and the naming described below. - Click Create library.
Choose what to sync
The library syncs exactly the groups you select. A group is the first segment of a token name: color/bg/surface belongs to color. Variable groups are counted per collection, and style groups per style type.
An empty selection means nothing, not everything. A new library needs at least one group.
To change the selection later, open the library and click Edit composition. Before you click Save composition, the bar shows how many tokens the next pull request will remove from the repository. It won't save a selection with no groups. The same lists are under Settings → Source.
Select the groups your aliases point to. An alias to a token outside the library becomes initial in CSS and is left out of the DTCG file.
Output formats
Pick one or more under Output formats. New libraries start with DTCG, JSON, CSS, TS and DTS.
Generate .d.ts types has the last word on the type file. When it's on and TS or JS is selected, tokens.d.ts is written even if DTS is cleared. When it's off, no tokens.d.ts is written.
Names
A token's code name is built in three steps:
- Naming template builds the name from placeholders. It must contain
{name}, the token name in Figma.{collection},{type}and{source}are optional. The default is{name}. - The result is lowercased, and every run of characters other than letters, digits and
/becomes a hyphen. Each/starts a new segment. - Name case formats each segment: kebab-case by default, camelCase or snake_case. CSS var prefix goes in front of the CSS variable; the default is
token.
Styles land under styles. in tokens.ts, and {collection} is empty for them. The prefix also applies to SCSS variables and text style classes.
Names are lowercased before the case is applied, so camelCase finds word breaks only at spaces, hyphens and other separators. radiusLarge in Figma becomes radiuslarge. Changing the template, case or prefix renames every token in the generated files, so plan it like any rename in code.
Modes
Modes strategy decides how light, dark and other modes are written. Mode names become kebab-case: Dark Mode turns into dark-mode. Modes with the same name in different collections share one block or file.
Inline values
tokens.css starts with a :root block that holds every token at its default mode. A [data-theme="<mode>"] block follows for each mode, the default one included:
Set data-theme on <html> or on any element to switch a subtree:
Mode blocks go into tokens.css only; with this strategy, tokens.scss holds the default values. A collection with a single mode gets a block too. Figma calls that mode Mode 1 until you rename it, which gives [data-theme="mode-1"].
Separate files
Each mode gets its own tokens.<mode>.css, and tokens.<mode>.scss when SCSS is selected. Every mode file writes to :root, and tokens.css keeps the defaults. This strategy needs CSS or SCSS among the formats.
DTCG and modes
The DTCG format has no modes, so FISYCO writes one complete file per mode, whatever the strategy. A token without that mode, such as a style, appears in every file with its own value. If no variable has two or more modes, you get a single design-tokens.tokens.json.
Units for numbers
Figma stores numbers without units, and padding: var(--token-spacing-md) needs one. In CSS and SCSS, FISYCO picks the unit from the variable's scopes, the places where Figma lets you apply it.
An alias carries no unit itself; the variable it points to does. JSON, TS, JS and DTCG keep plain numbers.
Text styles
A text style becomes a font shorthand variable in tokens.css, for example --token-typography-heading: 700 24px/32px "Inter";. It also becomes a class in token-styles.css:
The class name is the prefix, -style-, then the variable name, so the prefix appears twice. A style without a font family or size gets no font variable, because the shorthand is invalid without them.
Use the tokens
CSS
SCSS
tokens.scss declares a Sass variable per token, followed by the same :root block, so loading it also emits the custom properties. An alias stays a var() reference in Sass:
TypeScript
tokens.ts exports the tree as tokens, a flat tokenValuesByPath map and a tokenPaths list, all as const. Values by mode are keyed by Figma mode ID. An alias appears as { "$alias": "<variable ID>" }.
DTCG
An excerpt of design-tokens.light.tokens.json. Groups follow the name segments, a reference stays a reference, and $extensions keeps the Figma variable ID:
DTCG names carry no prefix. Groups use the same case as the CSS variables, so Style Dictionary builds --color-primary where FISYCO writes --token-color-primary. Text styles become typography tokens. Strings and booleans have no $type, because DTCG has no such types. Effects and gradients are left out.
Structure
Output structure is Single file by default: every file sits in the library folder. Layered moves CSS and SCSS into styles/, mode files into styles/themes/, and adds a styles.css entry:
The entry leaves out mode files, because each of them writes to :root. Load the mode file you need on its own.
Get the pull request
After a sync, open the library and click Create PR, or Update PR when one is already open. To skip the button, turn on Automatically create a PR after each sync under Settings → Pull Requests.
The description counts added, modified and removed tokens and lists the changes. A variable renamed in Figma keeps its ID, so it arrives as a rename. Files FISYCO delivered before but no longer writes are deleted in the same commit; other files in the folder stay untouched. To check each change before the pull request, see Review changes and pull requests.
A change to generation settings alone, such as a new prefix, changes no tokens in Figma. With automatic pull requests on, the next sync delivers it anyway, because FISYCO compares the generated files with the last delivery. A manual pull request needs a sync with changes.