-
Notifications
You must be signed in to change notification settings - Fork 94
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
Make args
and argTypes
available in meta.json
#426
Comments
Good question, I would like to use something like this too. The issue is that I see two solutions:
Index.argTypes = {
variant: {
options: ["default", "primary", "danger"],
control: { type: "inline-radio" },
}
}; however, this would fail const variant = {
options: ["default", "primary", "danger"],
control: { type: "inline-radio" },
}
Index.argTypes = { variant }; Does it make sense? |
Thanks for the link @tajo–I always assumed Personally, I think the CSF compatibility of Ladle is a great feature and it is worth the wait until a mutual standard has been set. |
They could be static, it's all simple arrays/objects but it's not been enforced in Storybook ecosystem (same with story titles, which Ladle actually strictly enforces and diverges from Storybook on that since it's critical for code-splitting and other features). Typically, devs assign args into a variable so they can spread it out over multiple stories. |
Closing, since this is not technically feasible. Anyway, we might have some better & analyzable controls API in the future. |
Is your feature request related to a problem? Please describe.
I find the Controls add-on very useful and am now exploring the possibility to generate snapshots for all available
arg
combinations (e.g.,Button
component with threevariants
+disabled
).This is an example of my current
Button
story:Describe the solution you'd like
Ideally, the
args
andargTypes
of each story would be available inmeta.json
. This would allow me to create snapshots for every combination automatically by passing the control via query parameters (e.g.,?arg-variant=primary&arg-disabled=true
).Describe alternatives you've considered
meta
objectThe text was updated successfully, but these errors were encountered: