Skip to main content

Hi, I’m trying to create a component through a plugin that has four variants, and each variant includes a boolean property. Couldn’t really find something?!


For fun, I tried giving the task to ChatGPT o1.

Beside some “code” it also wrote:



Note: In Figma’s newer component properties system, you can directly attach a boolean property to a single variant (so that you don’t need separate variants for icon on/off). However, the Plugin API (as of now) typically requires you to create multiple variant nodes if you want a boolean property to appear in the properties panel.



Is this correct?

From the above, I still don’t understand whether you need a variant property with a boolean value or a component’s boolean property. In either case, you can use the addComponentProperty method, but for the first case, the value must be a string type, and for the second—a boolean type.


I don’t want to discuss the crap that AI bots write, but you can add a component property to ComponentNode or ComponentSetNode.



Also:




Thanks for linking the other threads! It works.


That one helped:


Reply