Duplicate master component

Is there a way to duplicate a component as a master (not instance) while maintaining it’s properties? I can create an instance, detach it, then make it a component again but the properties are lost when detaching.

Copy the master component and paste it into another file, then cut and paste into the first file.

2 Likes

When I copy/paste, it doesn’t paste as a master, it pastes as an instance.

2 Likes

Did you copy the master component and paste it into another file?

Yes. When I do that, it’s just an instance. Do you get different results? If I do a variant set, that actually does, but not a single master component.

1 Like

In order not to suffer, select the desired object on the canvas, open the console and apply the following code:

figma.currentPage.selection[0].clone()
15 Likes

It worked. Thanks

It’s so cool to use the console for things like that! Apart from the main dev documentation is there some resoource that collects useful snippets like this one? I tried a few times to invest more time into learning the code behind Figma but get swept away by the many design tasks I have.

Don’t wanna be lazy though, I’m just curious if someone was already so kind to share a few of those…

1 Like

Unfortunately, I can’t suggest any resources other than official developer documentation and various GitHub/GitLab solutions.

You can also search for scripts for the Scripter plugin.
For example:

Thanks! I know the scripter plugin, that’s what actually made me curious in getting into direct automation. But actually, I think it’s best to simply learn the language to really start using it, there’s usually no real shortcut.

But at least I’m now interested in taking another look into the Developer docs :sweat_smile:

@Eric10 I just noticed that CMD+D or Strg+D “Duplicate” actually creates a clone even of master components. I was not aware but that’s now probably the easiest way to achieve your goal :smile:

1 Like

Duplicating doesn’t seem to work for me. Copy/past, Option + drag, all do the same - create an instance. Unless I’m missing something. Here’s a screen recording. https://www.loom.com/share/b0a9818fa4884ca0b6e4ce43ed61d6ca

You’re right, it only works with component sets that contain variants. I think consistent behaviour would be nice but it’s probably just because duplicating a component set cannot produce a single object like it is the case for a component.

So I take back my claim of having the fastest solution available and hand it back to the console command then :sweat_smile:

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.