Skip to main content
Solved

Swapping Variants of Nested Components

  • November 22, 2023
  • 3 replies
  • 1910 views

Hey folks,

I am currently working on a complex component that consists of nested components and Booleans.

As the nested components have different states as well, I added variants to those. If I click on the surrounding parent component and want to swap the variants of the nested child component, it only allows me to swap the complete instance and not its selected variant.

Please see this architecture sketch:

Parent Component

  • Variant 1
    ** Child Component
    *** Variant a
    *** Variant b
    *** Variant c
  • Variant 2
  • Variant 3

I find it much more comfortable to sort all of such similar components as variants. Is it still possible to swap them or do I have to make them separate components to do so?

Best answer by Michael_Persson

You can expose variants by adding them as properties in their parent component.

There are also plugins that work «roughly» in the same manner, which could see some use: https://www.figma.com/community/plugin/1027413532986522043/selection-variants

View original

Michael_Persson

You can expose variants by adding them as properties in their parent component.

There are also plugins that work «roughly» in the same manner, which could see some use: https://www.figma.com/community/plugin/1027413532986522043/selection-variants


Awesome. That was the missing piece. I cannot believe I have overseen this feature. Thanks.


Michael_Persson

In fairness, I believe it is a fairly new feature. Glad to spread the gospel!


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