Assign object to 2 boolean component properties

Has anyone figured out a way to assign an object to 2 boolean properties?

For example, we support a button that can have 1 of 3 layouts:
No icon: Label
Icon on the left: Label
Icon on the right: Label

I’m able to simplify my variants greatly by turning Icon-left and Icon-right into 2 booleans, each linked with a variant swap to grab the icon components. However, I want to exclude the use case where both left and right icon booleans are enabled: Label

I think this could be done by assigning each icon to 1 True and 1 False boolean.

I’ve accomplished something similar in a different component with variants (a description is only allowed in certain layout variants of a notification), but in the button case, I end up with the same number of variants as pre-props days.

2 Likes