Figma Integration
Sync Canon design tokens between code and Figma using Tokens Studio. The CSS tokens are the source of truth; Figma receives generated exports.
Architecture
Design tokens flow from code to Figma, ensuring consistency across engineering and design.
Quick Start
Get Canon tokens into Figma in three steps.
Install Tokens Studio
- Open Figma
- Go to Plugins > Browse plugins in Community
- Search for "Tokens Studio"
- Click Install
Import Canon Tokens
- Open Tokens Studio plugin
- Click Settings (gear icon)
- Under "Token Storage", select Local document
- Click Import > From file
- Select
packages/components/src/lib/styles/tokens.figma.json
Apply to Figma
- In Tokens Studio, select the "core" token set
- Click Sync styles for typography and shadows
- Click Sync variables for colors and spacing
Token Sets
Canon tokens are organized into sets for different themes and use cases.
core Default dark theme tokens Base design workthemes/light Light theme overrides Light mode designsthemes/high-contrast High contrast overrides Accessibility designsApplying Themes
Theme sets override core values for the same token paths. Enable multiple sets to compose themes.
Always enabled. Provides base dark theme.
Enable for light mode. Overrides color tokens.
Enable for accessibility. Increases contrast ratios.
Sync Workflow
Keep tokens synchronized between code and Figma.
Code to Figma (Most Common)
When CSS tokens change, regenerate the Figma export and re-import.
# 1. Regenerate Figma tokens
pnpm --filter=components tokens:export
# 2. Commit updated token files
git add packages/components/src/lib/styles/tokens.figma.json
git commit -m "chore(tokens): sync design tokens"
# 3. In Figma, re-import tokens.figma.json via Tokens StudioFigma to Code (Design Exploration)
When exploring new tokens in Figma, the process is manual to maintain source of truth.
Export tokens from Tokens Studio as JSON
Review changes with designer
Manually update tokens.css (source of truth)
Run pnpm tokens:export to regenerate all formats
tokens.css is always the source of truth. Figma exports are for reference only. Never edit generated files directly.Token Type Mapping
CSS token prefixes map to specific Tokens Studio types.
color-* colortext-* fontSizesfont-sans/mono/serif fontFamiliesfont-light/regular/... fontWeightsleading-* lineHeightstracking-* letterSpacingspace-* spacingradius-* borderRadiusshadow-* boxShadowduration-* durationFigma Variables vs Styles
Tokens Studio can create both Figma Variables and Figma Styles. Use the right one for each token type.
Variables
Recommended for colors, spacing
- Support mode switching (dark/light)
- Can be used in Auto Layout
- Native Figma feature
- Best for:
color-*,space-*,radius-*
Styles
Required for shadows, typography
- Support complex composite values
- Required for multi-layer shadows
- Better for typography presets
- Best for:
shadow-*,text-*
Use Sync variables for primitive values and Sync styles for composite values.
File Structure
Token files are organized in the components package.
packages/components/
├── figma/
│ ├── README.md # Figma integration docs
│ └── tokens-studio.config.json # Tokens Studio configuration
├── scripts/
│ └── generate-exports.mjs # Token export generator
└── src/lib/styles/
├── tokens.css # Source of truth
├── tokens.figma.json # Tokens Studio format
├── tokens.dtcg.json # W3C DTCG format
├── tokens.scss # SCSS variables
└── canon.json # Categorized formatRemote Sync (Team Collaboration)
For team collaboration, configure remote storage to sync tokens automatically.
GitHub Sync
Tokens Studio can sync directly with the GitHub repository.
- In Tokens Studio settings, select GitHub storage
- Enter repository:
createsomethingtoday/create-something-monorepo - File path:
packages/components/src/lib/styles/tokens.figma.json - Branch:
main - Generate a GitHub personal access token with
reposcope
Troubleshooting
Common issues and their solutions.
Tokens not appearing in Figma
- Ensure correct token set is enabled
- Click Refresh in Tokens Studio
- Try re-importing the JSON file
Colors look wrong
- Check if rgba values are supported
- Verify the correct theme set is applied
- Check for token reference errors
Typography not applying
- Ensure the font is installed in Figma
- Check font family name matches exactly
- Use Sync styles for typography
Shadows missing
- Shadows require Sync styles, not variables
- Multi-layer shadows may need manual adjustment
- Check rgba opacity values
Philosophy
Single Source of Truth
tokens.css defines all values. All other formats (Figma, SCSS, DTCG) are
generated outputs. Never edit generated files directly.
Weniger, aber besser
Only tokens that earn their existence. No decorative variations, no unused semantic tokens.
Tool Transparency
The sync process should recede into use. Designers see tokens; engineers see CSS variables. The bridge is invisible.