-
-
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
Addon-controls: Handle no-args stories gracefully. #10976
Comments
A visible warning in the IMO showing the controls by default makes you realize that you need to process them in the Story to make something happen, or if you don't want them then you proceed to disable the tab for the Story with |
Good point @shilman. Strawman:
Notes:
I don't have much context on this. Can we switch between props table with and without controls? |
@domyen Yes, the controls data is handled separately from the props table data, so when there is a no-args story function, we still have everything we need to show a standard 5.3-style props table if we wanted. I'll put together a quick POC for your suggestion and we can iterate from there. Thanks! |
Here's the POC in "compact" mode: Here's the POC in "expanded" mode: The user can toggle between the two modes using the |
Looks really good! |
perhaps, another way to say it, is that the Story is not configured to handle control args, and that's why there are no controls inferred. So another warning message could be:
|
Missed your comment but will tweak it for the next release. Good call |
¡Ay Caramba!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-beta.19 containing PR #10986 that references this issue. Upgrade today to try it out! You can find this prerelease on the Closing this issue. Please re-open if you think there's still more to do. |
@matheo how do you disable control for a given arg? Lets say I don't want to have control auto-generated for the Function type. |
@matheo not that I want to remove the whole row, I'd actually prefer for the name of the prop and its type and description to stay - just to hide the control for the given arg row. |
@jayarjo you can try:
|
@matheo talking about |
I found this one:
in this PR |
@matheo wow, it works! Not sure how 'cause I was looking for it in type definition of the |
Why
Currently, no-args stories offer a poor experience in
addon-controls
. We disable the controls because the story is not making use of the args anyway, so nothing would happen if they were available to the user. Unfortunately, ALL pre-6.0 stories are no-args stories, so this is a bad out-of-box experience for users who are upgrading from an older storybook:What
We should provide a better UI in this case:
The text was updated successfully, but these errors were encountered: