-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to show boolean props as "prop={boolean}" #193
Comments
My read on this is that there's code to not add the prop when the value is |
This is "by design", in that we assumed that usually a false Figma boolean mapped to a React prop should result in the prop not being output, rather than being output as false. However, this doesn't account for cases like yours. We actually have the concept of |
@tomduncalf-figma thanks for considering this use case! We also sometimes have boolean props that default to true so in those cases, showing an explicit |
I raised this here as well: #155 |
It would be awesome if there was a param on |
Hey! I'm working on Meta's internal design system with @vjeux and piloting code connect.
We have a few components where boolean props are required so the current way figma code connect displays booleans is incorrect. Some examples of this are components like switch, checkboxes, radio.
Here's an example for how we've connected up our switch:
For most boolean props, showing them when true and hiding them when false is mostly fine (though the convention in our codebase is to always be explicit). However, for required boolean props we end up with incorrect results like so:
The correct code should look like this when false:
And like this when true:
If
value
is not provided, our type checker will throw an error since it's a required prop.Is there a good way to specify that a boolean should be explicitly shown in the code snippet? Maybe an API like this?
The text was updated successfully, but these errors were encountered: