code-connect
code-connect copied to clipboard
Variant restriction from nestedProps
It would be helpful to be able to create a variant restriction from a nested prop. Is this currently possible?
this would be also very helpful on Figma client 😅
+1 Agree this would be helpful 🙏 I'm currently trying to create a variant based on a nested prop. This is my use case
figma.connect(Input, figmaUrl, {
props: {
input: figma.nestedProps('Text Field', {
leftIcon: figma.boolean('Show left icon', {
true: figma.instance('Left icon').getProps(),
false: undefined,
}),
}
},
variant: { 'Show left icon': true }, // doesn't work because this only works for parent properties
example: ({ input }) => (
<Input>
<Input.Icon name={input.leftIcon.name} />
</Input>
),
})
Alternatively, if we could conditionally render based on the props and do away with the variant restrictions, it would solve the issue as well. Thank you Figma team!
We are experiencing the same issue, would love to be able to render a completely different react component based on the value of a nested property