Skip to main content
Solved

How can I put the component in the same component? (Cycle detected)


Matt_Koziorowski

Hey, is there a way to put the component in the other instance of the same component? I’d like to use basic layout components across my design system so it’d be soooo useful.

If it’s not possible - is there a way to bypass it in a different way than building similar components with different name?

Best answer by Gleb

Using nested instances like you are probably doing is the only way to achieve this. If you want to swap out the card contents in instances freely, there is an ongoing feature request for this: Fully Editable Component Instances

View original

3 replies

Gleb
  • Power Member
  • 4706 replies
  • March 16, 2021

How do you imagine putting a component inside of itself? What would it do? This will create an infinite amount of components nested in each other, that’s why it’s not allowed. You can create a layout component and it’s ready to be used anywhere you want, why do you want to put it inside of itself?


Matt_Koziorowski

For instance, I have a complex component called Card which I use across the system (both in web and mobile apps, with different properties of course). It has many variants, such as background colour. I’d like to use this component card with gray background in a Card with a white background just for not rebuilding the same component in a different way.

As you can see, I use overrides for injecting any content inside my card component.


Gleb
  • Power Member
  • 4706 replies
  • Answer
  • March 16, 2021

Using nested instances like you are probably doing is the only way to achieve this. If you want to swap out the card contents in instances freely, there is an ongoing feature request for this: Fully Editable Component Instances


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings