Currently variant swap acts as a complete component swap. All its properties get overridden and are not controlled by the master component anymore.
For example:
- I have a “tab” component with two states: “active” and “inactive”.
- Once I do a variant swap (set the first tab as “active”), the “tab text” property receives an override. At this step all still looks good, but…
- …if I want to change the text on the first tab from “Section 1” to “Section A” — I can’t. It’s not inherited anymore.
This was already raised on this forum as a question, but not as a feature proposal. So I’m adding one.
There is a workaround
- I pack all component states into a single auto-layout frame and make that a component. If I need an active tab, I switch off the visibility of the inactive part.
- Now all works as it should
- But it gets very clumsy / hard to maintain if I have hovers, or I have not 2 states but 5 (primary, secondary, error, etc.) or I use component property as a breakpoint switch.
–
It would be great to be able to swap variants without losing connection between all properties which were not changed by the swap.
That would allow, for example, create a variant per breakpoint and inherit that breakpoint value from the theme (set in variables).