Closed sekeidesign closed 4 weeks ago
I believe something like this should work (see this comment for more details):
{
props: {
description: figma.boolean('description?', {
true: figma.string('description'),
false: undefined
}
}
}
Thanks @mryechkin, this is correct! If you have issues with this @sekeidesign, please let us know.
We are going to look at adding some more documentation on common patterns like this, as it's not necessarily obvious.
I'm not sure how this would work, but it would be great to be able to dynamically remove props from the examples based on other boolean values.
In this example, when
description?
isfalse
, the Figma Props UI is smart enough to hide thedescription
prop entirely, even though that prop still has a value. However, I'm not able to hide this prop in code, so the component snippet is wrong and will add text to the component that shouldn't be there at all.