create_variable
Create a new design token variable in a Figma collection. Specify name, type (COLOR, FLOAT, STRING, BOOLEAN), and optional initial value.
Instructions
Create a new variable (design token) inside an existing collection. Returns the new variable's ID. Use get_variable_defs to find collection IDs, set_variable_value to set values per mode, and bind_variable_to_node to apply the variable to a node property.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Variable name — use slash notation to group e.g. 'Color/Primary', 'Spacing/MD' | |
| type | Yes | Variable type: COLOR (hex color), FLOAT (numeric dimension/spacing), STRING (text), or BOOLEAN (true/false toggle) | |
| value | No | Initial value for the first mode. COLOR: hex e.g. #FF5733. FLOAT: number e.g. 16. STRING: text. BOOLEAN: true or false. | |
| collectionId | Yes | ID of the variable collection to add this variable to (from get_variable_defs) |