-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
ArgControl: Add Union Type Arg Control #22912
Conversation
No dependency changes detected. Learn more about Socket for GitHub ↗︎ 👍 No dependency changes detected in pull request |
@cdedreuille Hey Charles. Can you take a look at this to get an idea of how, design-wise additional controls for union types should look like? |
432ef3b
to
9c61fda
Compare
@cdedreuille @domyen could you please chime in? Thank you! |
'&[type="number"]': { | ||
/* without this we will have inconsistant height */ | ||
padding: '0px 10px', | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's an argument here to set a fixed height on the input instead of modifying paddings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i had these options, i went with padding to avoid fix height, i guess only design team can make the call 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me know which one we go with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the video you shared @chakAs3, I can see that when you are activating the boolean, the height get increased. Can you make these changes:
- Make sure all inputs are vertically aligned
- Make sure the height is never increased (with exception for Textarea that could be increased of course)
After thinking more about it, I'm a bit confused by how it should work. From what I see we have 2 parts for it:
As a quick guidelines:
|
i'm with this partially, it is not always good to add an extra click when you can have one, most of time user will have 2 to 3 type, i suggest to have 3 max to display more than that 'Show all types' |
@chakAs3 We can't rely on assumption or personal biases to make a call on these ones. I would much prefer we take the time to create a flow that would work for more use cases. Also, I don't think this would be a good behaviour to mix too many things on each line. I'm happy to take a bit of time in the next few days to find a solution to this with you. Ping me on Discord if you want. |
I believe it's generally not advisable to mix too many elements on a single line unless there's a compelling reason to do so. It's essential to consider the tradeoffs involved.
I completely agree. That's why I suggest we consider conducting a canary release on this PR, allowing our users to provide valuable feedback. In the meantime, we can take the time to come up with the best solution, one that's supported by user feedback. In my opinion, Storybook is a tool that helps developers create and document components conveniently. It should also help in identifying bad practices and behavior in code. For instance, if a user decides to use a component with a union of 10 types, which is generally considered a less than ideal coding practice, Storybook can serve as a helpful tool. It can visually demonstrate to the user that mixing all these types may not be a good approach. This, in turn, can prompt the user to rethink their approach and find a better solution. In fact technically user can have max four: boolean, number, string, and object for union types. In terms of UX, providing users with the option to test their union type props using multiple controls (even 3+) is preferable to forcing them to use a single control. Storybook's goal should be to empower users, not impose restrictions on them |
I think the best way to move forward here would be to explore all the different options in design first before coming back to code just to make sure we take the right decision. We can use the design to share this to the community and ask feedback. Creating a canary will only show one version and it is quite demanding for such a small update. I would advise to stick to design for now and use Discord to share some sketches. I would be happy to support you to mock these ideas out if you want. |
I think a lot of people could benefit from this feature but to make it right, it would be great if you could write an RFC detailing all the specifics of this features, how the API will be structured and what are the different design options we could go. I would be happy to share some design thoughts on this RFC if needed. For now I'll close this PR. If we find a good solution after writing the RFC, we could reopen it. |
Closes #
What I did
This PR introduces additional controls to allow for switching between types (ex: string | number ), as existing Storybook functionality only provides one control for this purpose.
unionArgControl.mov
How to test
Checklist
MIGRATION.MD
Maintainers
make sure to add the
ci:merged
orci:daily
GH label to it.["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]