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-actions: Add Storybook Args support #10029
Conversation
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.
Looks good, couple of little things
addons/actions/README.md
Outdated
``` | ||
|
||
Alternatively, suppose you have a naming convention, like `onX` for event handlers. The following configuration automatically creates actions for each `onX` argType (which you can either specify manually or generate automatically using [Storybook Docs](https://www.npmjs.com/package/@storybook/addon-docs). |
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.
Maybe add an example of how you'd provide an argType to the story? Or is that sort of pointless?
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.
Waiting on this until the argTypes design is finalized
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.
Lgtm
Issue: N/A
What I did
Storybook Args is a new format for stories that passes a dynamic data object "Args" into story functions. This can be used to automatically provide actions event callbacks into stories and components.
This PR adds two forms of Args compatibility using story parameters.
argTypes.action
that adds an action for each matching argTypeactions.argTypesRegex
that adds an action for each arg type name that matches the given regex.See the updated stories for examples.
How to test
See attached tests and
official-storybook
stories