Back to Plugins
Token Lab

Token Lab

Generate Design Tokens from Figma Variables

tokensvariablescode-generators

Plugin Preview

Token Lab preview

About this plugin

Convert your Figma variables into Design Tokens, ready for consumption by Style Dictionary.


The plugin requires at least one variable to exist in the Figma document. With that present, pressing the "Export Variables" button will convert the variables table into JSON objects, in the following structure:


// collection-1.json

{

  "collection-1": {

    "my-variable": {

      "value": "#ffffff"

    }

  }

}


If variables are grouped the structure becomes:


// collection-1.json

{

  "collection-1": {

    "group-name": {

      "my-variable": {

        "value": "#ffffff"

      },

      "another-variable": {

        "value": "#000000"

      }

    }

  }

}


If modes are used, those are added like so:


// collection-1-mode-one.json

{

  "collection-1": {

    "group-name": {

      "my-variable": {

        "mode-one": {

          "value": "#ffffff"

        }

      }

    }

  }

}

// collection-1-mode-two.json

{

  "collection-1": {

    "group-name": {

      "my-variable": {

        "mode-two": {

          "value": "#000000"

        }

      }

    }

  }

}


If a description is added to a variable, it will be included as a comment:


// collection-1.json 

{

  "collection-1": {

    "my-variable": {

      "value": "#ffffff",

      "comment": "A Figma description"

    }

  }

}


This plugin has primarily been built and tested for one specific team, your mileage may vary.

Plugin Details

Version3
CreatedSeptember 28, 2023
Last UpdatedFebruary 22, 2024
CategorySoftware development
CreatorSam Smith
Stats89 installs, 3 likes
PricingFree

Technical Details

  • API:1.0.0
  • UI:{"export": "export.html", "configure": "configure.html"}
  • main:code.js
  • Editor Types:
    figma
  • Allowed Domains:
    • none