Figma Support Forum

Allow nesting component instances into the same instances (not directly)

Intro

There is an interesting concept in Figma that’s used and was presented by multiple people and has different names: Placeholder, Slots, Dummies, Layout Blocks, and so on:

  1. ❖ Placeholder component is the base one.
  2. ◇ Placeholder instances may be nested into another ❖ Component.
  3. ◇ Placeholder instances nested into ◇ Component instances may be swapped with any other component instances…
    More details in this video by @Adam_Ruthendorf-Przewoski.
    The next step of its evolution is Layout Blocks by @Mr.Biscuit.

An issue

  1. I have a base ❖ Placeholder component:
    image
  2. ◇ Placeholder instances may be nested into other components (❖ Column here):
  3. What I need is to nest a ◇ Column instance into another ◇ Column instance by swapping one of the ◇ Placeholders.
    This is needed to customize Auto Layout spacings and other properties:
  4. But when I try to do this I see an error message Failed to set component: cycle detected!:
    image

I totally understand why we’re not allowed to nest instances into their Main components — it will create an endless cycle such as infinite screen share:

But actually, it is not endless — we always will have the last one ◇ Placeholder instance as a stop point:

My Demo file to better understand what’s going on.

Possible solutions

There are a couple of solutions that solve this issue but still are not optimal:

  1. Have multiple absolutely identical components to nest one into another.
  2. For the upper-level use a component with more placeholders inside and hide unnecessary ones.
5 Likes

A break down of this while we were discussing this:

2 Likes

@Andrei_Iancu OMG so you typed all that on a phone :rofl:

3 Likes

This makes a lot of sense, but I think gives the wrong impression for what Figma needs to implement.

This issue arises because we’re trying to figure out hacky ways to have a reusable Box Component, and ‘replace me’ is the best we can do so far. This ‘cycle detected’ thing becomes an issue only because of this hacky workaround.

Step 1, we need the capability to create a “Frame Component” and put any elements inside them, Components or not.

Loosening the ‘cycle detected’ restrictions is an added bonus, as naturally, people will have reusable components that they would want to use inside this Frame Component and that Frame Component may end up being used inside itself if it’s a very common use case.

Box Components are the foundation to literally every design component. It’s surprising this isn’t the #1 requested feature. It says a lot about the design community and what we expect (or don’t expect) from our tools. /endbabyrant

1 Like

That’s a very good point! There is a feature request for this already: Fully Editable Component Instances

I think removing the cycle restriction might be easier to implement than a full feature like this. So in the meantime that would be nice. But adding a fully editable content field to components would be life-changing.

I think I found a non-optimal solution #3 by using a component group (variant) container to create a “warp zone” to evade cycle detection. (Getting inspired by @Andrei_Iancu’s Limgo portals! :laughing:) In this example I have an empty variant slot, and swap one of the ◇ 3-row’s ◇ Placeholders with the empty variant slot. And then I drop in another ◇ 3-row into the empty variant slot. No cycle detected. You just need to keep the first (top left) variant empty and it seems to work.

Edit: You don’t even need to use variants — an empty “❖ Placeholder Holder” could work to prevent cycle detection as well. The component group (variant) container does make it easier to group and create as many as needed, though.

1 Like