Skip to main content
Solved

How to fetch component keys from team library?

  • September 8, 2023
  • 2 replies
  • 1365 views

I am trying to make a plugin to download all components from a selected team library.
(without having the user to import the components in the document manually, or hardcoding all the component keys)

I found a way to fetch the “variable collection” from a team library, but it seems there is no possible way to directly fetch the “components” from a team library.

So I am trying to make the plugin to

  1. import the components into the document, and then
  2. fetch them from the document

I am trying to find a way to do step 1, which I probably will use importComponentByKeyAsync, but I need a way to find the component keys with the plugin.

Are there any possible ways to do this?

Best answer by tank666

If you are running the plugin in a non-library file, you can get the keys for components and component sets using the REST API.
https://www.figma.com/developers/api#get-file-components-endpoint
https://www.figma.com/developers/api#get-file-component-sets-endpoint

View original
This topic has been closed for comments

2 replies

tank666
  • 4868 replies
  • Answer
  • September 8, 2023

If you are running the plugin in a non-library file, you can get the keys for components and component sets using the REST API.
https://www.figma.com/developers/api#get-file-components-endpoint
https://www.figma.com/developers/api#get-file-component-sets-endpoint


  • Author
  • 1 reply
  • September 13, 2023

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings