VarVar is a Figma plugin that allows you to export your Figma variables to JSON, CSV, CSS, or JavaScript formats, and import them back in from JSON, making it easier to integrate your design tokens into your development workflow.
- Multiple Export Formats: Export Figma variables to JSON, CSV, CSS (vanilla or Tailwind CSS v4), or JavaScript
- JSON Import: Re-populate collections, modes, variables, and linked-variable references from a previously exported JSON file, with an optional "replace existing variables" mode β see below. CSV/CSS/JS import isn't supported, since those formats aren't reliable round-trip sources.
- Format-Specific Menu Commands: Direct access to each export format from the Figma menu
- Linked Variable Support: Identifies and properly handles linked variables across formats
- Scope-Aware Types: JSON, CSV, and JS exports map variable scopes (
CORNER_RADIUS,FONT_WEIGHT,OPACITY, etc.) to DTCG$types instead of exporting bare numbers - Extended Collection Hierarchy Export (Enterprise, BETA): All export formats detect Enterprise extended collections and preserve the inheritance model instead of flattening it β see below
- Preview & Copy: Preview exported data and easily copy to clipboard
- Automatic Downloads: Exported files are automatically downloaded
- Row/Column Positioning: CSV option for spreadsheet formula-like linking
- JSON: Linked variables start with
$.VARIABLE.PATH - JavaScript: Linked variables are referenced directly like
collection.mode.variable- Numeric paths are converted to bracket notation:
collection.mode["500"]
- Numeric paths are converted to bracket notation:
- CSV: Linked variables start with
=VARIABLE/PATH- Option: Use row & column positions to produce formula-like linking (i.e.
=E7) in spreadsheet programs
- Option: Use row & column positions to produce formula-like linking (i.e.
- CSS: Linked variables use CSS custom property syntax:
--var-name: var(--VARIABLE) - Tailwind CSS: Linked variables use CSS custom property syntax with Tailwind naming conventions
Note: When dealing with linked variables that have multiple modes, the plugin will only link to the first occurrence (i.e., the first mode).
Figma's Enterprise-only extended collections let a "child" collection (e.g. a brand) inherit from a "parent" (e.g. a base design system) and override only what differs. All four export formats now detect this and preserve the hierarchy instead of flattening it:
- Values actually overridden in the child collection keep their own value.
- Everything else is exported as a reference into the parent collection's tokens (a
$valuealias in JSON, a plain CSS cascade in CSS, an=Collection/mode/Variablereference in CSV, a property-path reference in JS). - Every value is tagged as inherited or overridden (
$extensions.figma.inheritedin JSON, anInheritedcolumn in CSV, aninheritedfield in JS; CSS relies on the cascade itself rather than a tag). - JSON only: output splits into
base.tokens.json(all non-extended collections) plus one file per extended collection, bundled into a single.zipdownload. CSS, CSV, and JS stay single-file, representing inheritance inline.
This only activates when extended collections are present in the file β accounts without Enterprise extended collections see no change to their exports. This feature is new and we haven't been able to validate it against a real Enterprise file ourselves, so we'd love your feedback: open an issue if the output doesn't look right.
- Open Figma and go to the Community tab
- Search for "VarVar"
- Click on the plugin and then click "Install"
Access format-specific exports directly from the Figma menu:
- Open your Figma file containing variables
- Go to Plugins β VarVar β Choose your format:
- Export as JSON - Structured JSON data with nested groups
- Export as JavaScript - JavaScript objects with proper references
- Export as CSV - Spreadsheet-compatible data
- Export as CSS - CSS custom properties for web development
- Tailwind CSS or vanilla - Tailwind CSS format with
@themedirective (BETA)
- Tailwind CSS or vanilla - Tailwind CSS format with
- Configure filename and options (if applicable)
- Click "Export Variables"
- The exported file will be automatically downloaded
For format selection within the interface:
- Open your Figma file containing variables
- Go to Plugins β VarVar β Export Variables
- Choose your desired export format
- Configure filename and options
- Click "Export Variables"
- The exported file will be automatically downloaded
- Toggle the "Preview output" switch to see the exported data within the plugin interface
- Use the "Select to Copy" button and copy (Ctrl/Cmd + C) the exported data to your clipboard
Note: Programmatically copying is currently not supported by Figma Plugin APIs.
- Open your Figma file
- Go to Plugins β VarVar β Importβ¦
- Choose one or more JSON files previously exported by VarVar (current or legacy format; if you exported an Enterprise extended-collection
.zip, select its unzipped files together) - Optionally toggle Replace existing variables β this deletes every existing local variable collection in the file before importing, not just the ones named in the JSON, so you'll be asked to confirm before it runs
- Click "Import Variables" β collections, modes, variables, and linked-variable references are recreated, and a summary of what was created/updated (plus any warnings) is shown
Note: Only JSON is supported for import β CSV, CSS, and JS aren't reliable round-trip sources for reconstructing variables.
Note: A leading
.or_is Figma's own convention for marking a collection, variable, or group "private" (hidden from publishing) β common in real design systems, not an edge case. Import handles it correctly: linked-variable references are matched against your file's actual collection/mode names rather than blindly split on., and any newly created collection/variable whose name starts with.or_getshiddenFromPublishingset to match, so the privacy actually carries over. Check the import summary's warnings for anything it couldn't confidently match.
VarVar is built with a modular architecture for maintainability and scalability:
- Type System: Strict TypeScript enums and interfaces for type safety
- UI Components: Reusable React components for consistent interface
- Format Views: Dedicated views for each export format
- Export Utilities: Format-specific processing functions with JSDoc documentation
src/
βββ components/ # Reusable UI components
β βββ PluginDialogShell.tsx # Layout shell with padding and footer
β βββ ExportHeader.tsx
β βββ ExportLayout.tsx
β βββ FilenameInput.tsx
β βββ ExportButton.tsx
β βββ OutputPreview.tsx
β βββ ExportOptions.tsx
β βββ FileImportInput.tsx # File picker for JSON import
β βββ ImportOptions.tsx # "Replace existing variables" toggle
β βββ ConfirmReplaceDialog.tsx # Confirmation for the replace-existing import path
β βββ ImportSummaryPanel.tsx # Import result counts and warnings
β βββ Footer.tsx
βββ hooks/ # Custom React hooks
β βββ useExportData.ts # Hook for managing export data and state
β βββ useImportData.ts # Hook for managing import data and state
βββ views/ # Format-specific export/import views
β βββ ExportView.tsx # Generic export with format selector
β βββ ExportJSON.tsx
β βββ ExportCSV.tsx
β βββ ExportCSS.tsx
β βββ ExportJS.tsx
β βββ ImportJSON.tsx # JSON import view
βββ utils/ # Export/import processing utilities
β βββ collectionToJSON.ts
β βββ collectionToCSV.ts
β βββ collectionToCSS.ts
β βββ collectionToJS.ts
β βββ collectionToTailwind.ts
β βββ importJSON.ts # Parses exported JSON and recreates variables in Figma
β βββ clipboard.ts
β βββ color.ts
β βββ stringTransformation.ts
βββ types.d.ts # TypeScript definitions and enums
βββ code.ts # Plugin main logic
βββ ui.tsx # UI router and main app
To set up the development environment:
- Clone the repository
- Install dependencies:
npm install - Run the development server:
npm run dev
To build the plugin for production:
npm run build
VarVar is developed and maintained by Atropical AS.