Skip to content

Figma plugin that swaps variables. Like Swap Libraries but for variables

Notifications You must be signed in to change notification settings

qurle/swap-variables

Repository files navigation

Swap Variables for Figma

Just like Swap Libraries, but for variables.

Swap Variables cover

Readme на русском

How to use

Run it from the Quick Actions or Plugin menu. Select some layers, choose source and destination variable collections and hit Swap button.

You can choose the scope for plugin: selection, current page, all pages or local styles.

After all, you may see some error. Click on them to focus viewport on problematic objects.

How it works

Swap Variables will display all local and enabled external variable collections that actually contains variables.

When you swap these collections, plugin will recursively find every used variable, then check two things:

  • variable exists in source collection,
  • destination collection containt variable with same group and name.

After the plugin ends its job, it will display known ecnountered errors below Swap button.

Known limitations

  • If you modified external libraries, reload file to apply changes.
  • Plugin doesn't swap styles. Use Swap Libraries instead.
  • Plugin can't swap strokes in section. That’s not supported by Figma API yet. Do it manually instead.
  • It may take some time to parse and swap variables when there're to many nodes or variables. Take a break and make some tea.
  • Scoped variables was not tested.

Possible features

  • Clickable error allows to zoom in problematic layers.
  • Collections with 0 variables are hidden.
  • Ability to create new local collection.
  • Typographic variables.
  • Rebinding modes if the share the same name.
  • Multipage swap.
  • Swapping variables in local styles.
  • Gradient support.
  • Display number of variables in collection.
  • Selecting the option that's in second select makes them swap.

Problem? Idea? Kind words?

I accept feature suggestions and ideas to improve the plugin. No need to mess with hidden layers? Useful exceptions? If you have any ideas or issues, let me know in the comments.

Alternatively you can contact me via e-mail at [email protected] and Telegram.

<3