Figma Support Forum

Handle variants via api

Hello, I am new to Figma and I try to create a new plugin. One of the functionalities of the plugin is to switch the variant of a component. Is it possible via the API?

In the API, each variant is simply a regular component. So to switch them, you simply need to change the mainComponent of an instance to a different component. But you will lose all overrides. :slightly_frowning_face:

1 Like