Guides
Figma Workflow
How DS0 syncs design tokens and components between code and Figma.
Overview
DS0 uses a code-first approach to Figma integration. Tokens are defined in code and pushed to Figma — no paid plugins required.
Token Sync
Code → Figma (Primary Direction)
- Tokens are defined in
tokens/*.json(source of truth) scripts/build-tokens.tsruns StyleDictionaryscripts/sync-to-figma.tstransforms output to Figma Variables format- GitHub Action pushes to Figma via REST API on merge to
main - Designers see updated tokens instantly in Figma
Figma → Code (Designer-Initiated)
- Designer changes a variable in Figma
scripts/sync-from-figma.tspulls current Figma Variables- Script generates a PR with the token diff
- Developer reviews and merges
Figma Code Connect
DS0 uses Figma Code Connect (free) to map Figma components to React code:
// figma/button.figma.ts
import { figma } from '@figma/code-connect';
import { Button } from '../components/react/button';
figma.connect(Button, 'https://figma.com/...', {
props: {
variant: figma.enum('Variant', { Primary: 'primary', Secondary: 'secondary' }),
size: figma.enum('Size', { Small: 'sm', Medium: 'md', Large: 'lg' }),
label: figma.string('Label'),
},
example: ({ variant, size, label }) => (
<Button variant={variant} size={size}>{label}</Button>
),
});When a designer inspects a component in Figma, they see the exact React code to use.
Setup
- Install the Figma CLI:
npm install -g @figma/code-connect - Create mappings in
figma/[component].figma.ts - Publish:
figma connect publish