Hi, Iโm wondering whether it would be possible to create a plugin that fetches a component from a Figma file (based on a link I provide), which has one component, and recreates it when I run my plugin?
Page 1 / 1
Yes, itโs possible.
I do this by getting the key file in URL.
example:
URL = https://www.figma.com/file/<key>/name?type=design&t=xyz
I use REST API for get components list
curl -H 'X-FIGMA-TOKEN: xxx' 'https://api.figma.com/v1/files/<key>/components'
And then take key component for import using importComponentByKeyAsync
example:
const importComponent = await figma.importComponentByKeyAsync(key);
const instance = importComponent.createInstance();
const page = figma.currentPage;
page.appendChild(instance);
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.