Figma findOne and findAll

You get component key by going to the library file, opening the plugin and saving the key somewhere, for example into client storage. But I guess since you are planning on selling the components, you would need to get component keys first, then save them to a JSON on your server or a hardcoded array the plugin.


Stop being so focused on findOne, this method is used only when you need to search the whole doc or node children tree. It’s very slow and shouldn’t be used unless you absolutely need to search for the very specific kind of node and you don’t know where it is.

Here is how to create an instance of the component:

  1. Import component by key. Import method returns said component, so you don’t need to search for it anywhere, just save the import result to a variable.
  2. Create an instance of the imported component by calling component.createInstance(). Done.