Figma Support Forum

Move master components from different files to a new library

Hi everyone! Is there a way to move a master component to another library without losing the connections to all the instances of that component? We’re are trying to unify separate master components from many files into one library that is already published.

Almost every file in our teams use those components, so we need a safe way to keep everything linked, even if it has to be done manually.

6 Likes

My plugin Master can help you with that. It’s a bit of a manual process but Master can attach everything and preserve all overrides. Here is how it would work:

  1. Copy the main component you want to move to the library and publish it.
  2. Select this new library component, run the command: Plugins → Master → Pick Target Component.
  3. Go to the files with instances you want to attach this library component.
  4. Select instances you want to attach to the component and run Link Objects to Target Component command. They will be attached to the library component with all overrides preserved.

Here are some extra tips regarding the last step:

  • You can select instances quickly with the default Figma feature Edit → Select all with same Instance. However it doesn’t work for nested instances. You can also use plugins Select Similar, Similayer or Instance Finder to select instances.
  • If you select main component on the last step instead of an instance, Master will automatically find all instances of that component in the file and attach them.
  • You can also select nothing, in this case Master will find all instances of the component you previously attached. To clarify: select one instance or main component (B), link it to target component (A), then deselect everything (Esc) and run Link Objects to Target Component — Master will find all instances of component B in the file and link them to the target component (A). This is useful when dealing with lots of files and instances of one component in them.

Here is a video showing how the plugin works if you prefer this format:

Check out the interactive guide — learn Master through practice!

4 Likes

Thanks Gleb for your answer! I did used Master and I really liked it, but when I tried to link the instance to the new component, I lost all the written text on the instance, is there a way to avoid that?

1 Like

The order of layers in both components needs to match in order for overrides to be preserved. For example, if you have the following structure in one component: [Icon, Text, Rectangle] and then in another component you have [Icon, Rectangle, Text] layers or even [Icon, Text, Rectangle, Rectangle], Master will not be able to preserve overrides, unfortunately.

Sometimes you also could have an extra wrapping frame which will break this too. For example, if you are using an instance as a base component in one of the components and another component simply has all the contents in it.

Not matching components structure

In the case above, you can fix this by wrapping vector square in an extra frame. This will make the structures match again. (Even if “wrapper” is an instance, it would still work, since Master considers instances and frames similar objects.)

Do components you are trying to link have matching structures?

1 Like

Hi Gleb. I tried to use master for my problem, but I don’t think it works in my case. What do you think?

My issue is: I have a library at organization-level and a new library at team-level.
I want to move some components from my org lib to my team lib, without losing the links to all the instances in different files (also located in the same team as my new team lib).

Here’s what I tried : I copy-paste the component from org lib to team lib. It creates an instance. I turn the instance into a component. I choose it as the “target component” in Master. I come back to the old one (in org lib), click on it and click “link objects to target component”. But Master can’t find any objects linked to it (but there are).

Maybe it works only when moving local components to a lib? But not from lib to lib?

1 Like

Got the same issue here. On regular basis, we explore and create new components directly in the file we work in currently. At some point, we get into the clean-up mode where we select which of the local components can make it to the master library and are worth sharing.

Master plugin is of great help here @Gleb however, doing it component by component is a showstopper for us in most cases.

Every day, I dream of a solution similar to one we had in Sketch quite a time ago already:

We’ve switched to Figma almost a year ago already and we love everything about it, but managing and maintaining design systems is still quite a headache for us.

I wonder if anyone had similar challenges and got some solution to share to help.

Love you guys!

3 Likes

Thanks for the detailed explanation, Lucie! Yes, you are correct, this method works with local instances only. That’s because a plugin in Figma can only access one file that it’s open in. However, there is a workaround that I made to enable you to go through all files where it’s used and relink it.

  1. Save the new component as target as you did.
  2. Go to the old component and link it, like you did.
  3. Open the file where the old component is used, deselect everything and run “Link Objects to Target Component”. Master will find all instances of the component you linked on the second step and attach them to the saved target component.

You’ll need to manually repeat the third step in all files where the component is used. Hope this helps a bit!

1 Like

Hi Piotr! Unfortunately Figma API doesn’t allow to do that easily so there is not much that can be done by individual plugin makers like me. But I’m pretty sure Figma will be working on improving libraries this year so hopefully they’ll create a native solution. Feel free to search for relevant suggestions in the #product-ideas category and vote for them or suggest your own if you don’t find anything.

Thank you very much Gleb! I will try that.

2 Likes

The Figma team needs to fix this. Ok this plugin is amazing. Thank you very much Gleb! But this is an important problem. Figma team you need to fix this. Please!

2 Likes

@gleb This is pretty awesome! Doesn’t seem to work with variants, right? I’m on a team that uses a lot of atomic components that are organized as variants, and a new team needs to start sharing these atomic components. I currently have a separate shared library for color, type, and grids, and would like to move the existing atomic components to this shared library so both teams can use it. However, because most of them are organized as variants, I don’t think I’d be able to move them to the shared library and use the Master plug-in to “move” the master status from the existing file to the shared library file. Is my only option to “un-variant” the existing atomic components, and then move them to the shared library or am I missing something?

It works with variants the same way it works with regular components: each variant in the variant set is technically a regular component.

I understand that you want to link multiple components (variants) at the same time — that’s a very common question. Unfortunately currently it’s quite a technically challenging task, but I’m hoping to make it work with multiple components in the near future. Just not sure when, but I’ll definitely let everyone know once I update it.