[GH-ISSUE #82] Adjust prop naming conventions and defaults for easier use with JSX #51

Closed
opened 2026-05-05 11:32:33 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @j-f1 on GitHub (Apr 13, 2018).
Original GitHub issue: https://github.com/kusti8/proton-native/issues/82

I’ve noticed that many if not most boolean props in this library default to true. For example, in <Box />, all of the props except padded default to true. This makes it more difficult to adjust their values. For example, to render a horizontal, invisible box, you need to do this:

<Box vertical={false} visible={false} />

However, if the API was changed to use false props by default, this could be written this way instead:

<Box hidden horizontal />

This saves on typing (no ={false}) and is clearer IMO since you specify which features to enable, instead of which ones to disable.

What do you think?

Originally created by @j-f1 on GitHub (Apr 13, 2018). Original GitHub issue: https://github.com/kusti8/proton-native/issues/82 I’ve noticed that many if not most boolean props in this library default to `true`. For example, in [`<Box />`](https://proton-native.js.org/#/component_APIs/box), all of the props except `padded` default to `true`. This makes it more difficult to adjust their values. For example, to render a horizontal, invisible box, you need to do this: ```jsx <Box vertical={false} visible={false} /> ``` However, if the API was changed to use `false` props by default, this could be written this way instead: ```jsx <Box hidden horizontal /> ``` This saves on typing (no `={false}`) and is clearer IMO since you specify which features to enable, instead of which ones to disable. What do you think?
Author
Owner

@kusti8 commented on GitHub (Apr 22, 2018):

Seems like a good idea, but to change the name, I have to create an object mapping to translate it into libui terminology which I would rather not do since it can get really unwieldy.

<!-- gh-comment-id:383405946 --> @kusti8 commented on GitHub (Apr 22, 2018): Seems like a good idea, but to change the name, I have to create an object mapping to translate it into libui terminology which I would rather not do since it can get really unwieldy.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/proton-native#51
No description provided.