Hi, I am in a trouble of locating component on a different page than I am currently interacting with plugin.
In a documentation I found a way to select component on a current page with figma.currentPage.selection(), but I need to select component from page UI Kit.
Also, I managed to select only whole main component:
But I need to select only one variant from there.
Best answer by tank666
You just need to specify which variant you want to create an instance for. For example: buttonsComponent.defaultVariant.createInstance();
Thanks, that is exactly what I need, but how can work with that variable?
For example finding ComponentSetNode by name outputs me error, that says “Object is possibly null” and won’t let me compile.
Thank you very much 🙂 When I try to use your code it won’t let me compile it, until I add question mark behind every variable, because I am getting this error: Object is possibly ‘undefined’.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.