Move master components from different files to a new library

We used “Move Style definition” to this file in the end which worked!

I think it is worth noting for people moving master components or merging libraries that moving the styles over first may be an important step if the components you are using don’t have styles supported in the new library and you want all your styles in one place, ie if you are deprecated the first library.

1 Like

This has been a very insightful topic to follow! We are in the same position as Timothy above in that as an org, plugins are not allowed. Our DS also has the added concern of being mutli-brand, so the moving of our set of components has from their original library to a new one has to work the same across five different brands, all which then need to be able to swap three separate libraries with each other and retain the nested instance overrides.

We’ve tested with two brands to make sure the swap library function still works after migrating components, and it’s all fine aside from any instance swaps that have been made. Very frustrating, and would love to hear of anyone having any joy with this feature!

1 Like

I don’t know if the way Figma handles this has changed but the way it was described in this thread and by Figma on Twitter didn’t work as described with our files. The other way around worked fine.

If you have an existing master file with components and designs:

  1. Publish the original master file as a library without changing anything
  2. Create a new file and connect the master file as a library.
  3. Cut the designs from anywhere in the original master file/library
  4. Paste in the new file - check that the component links work.
  5. Rename the old file as component library
  6. Continue working with the designs in the new file.

Worked for me after dabbling unsuccessfully with the original method.

Have you found any solutions? I have the same problem at the moment.

@Gleb Thanks for this. It worked AMLOST perfectly… For me it managed to find and replace all the relevant components, however, it left the layer on the file the same as it was?

Can you explain what you mean by this? What would you expect to happen and what actually happens?

It has gone through and changed the Button components to the correct version (v2), however, the layer has been left as v3.

Oh, that’s just the name of the layer, you can reset this override in the right panel. Master keeps all overrides, including layer names.

Nice! How do I do that all in one go for the 506 components in the file?

Ohhhh good question. Unfortunately Figma doesn’t have a way to reset a single override even through code (only all overrides). So the only way would be to manually change the name to match the main component. I found this plugin that can do that but there are also other plugins like this: https://www.figma.com/community/plugin/1118882302918088586/reset-layer-name

Also here is the little snippet of code I just wrote if you don’t want to reset all names in the file. Select an instance that already has the name you want. Then open the console and paste this code there, then press Enter to run it. This will find all instances of the same component in the file and rename them to the name of the instance you have selected.

var comp = figma.currentPage.selection[0].mainComponent
var name = figma.currentPage.selection[0].name
figma.root.findAllWithCriteria({types: ['INSTANCE']}).filter(n => n.mainComponent === comp).forEach(n => {
    n.name = name 
})

@Mario Hi! You can just use default Figma shortcut to transfer master component. Use this tutorial https://help.figma.com/hc/en-us/articles/4404848314647-Move-published-components