-
Notifications
You must be signed in to change notification settings - Fork 19
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 Knobs - Add function type #11
Comments
FYI, we’ve released Please upgrade and try out controls today! |
@shilman |
Nope. I'm just posting this on all knobs issues to let people know which way the wind is blowing. :) What are some use cases for a function control? |
@shilman Thanks for your quick answer and your interest. Use cases would be costum formatters or validators (e.g. if you would use form libraries like Basically any function which affects the rendering and does not fit for |
Is your feature request related to a problem? Please describe
I am discovering Knobs, I see many supported types (text, bool, number...) but nothing for functions.
How to create a knobs for a function ?
showModal={() => {}}
I tried to pass it as object but get a console error (Invalid prop knob.value supplied)
I also tried to pass as text with "() => {}" but of course it generates an error as the component propType want a function, not a string.
Describe the solution you'd like
Maybe we could have something like
showModal=func("showModal", () => {})
And the UI would convert it with an eval, but I am afraid this eval would bring security issues. Maybe something equivalent ?
Describe alternatives you've considered
None.
Are you able to assist to bring the feature to reality?
no
Additional context
Storybook 6
Reopening of storybookjs/storybook#9265
SO: https://stackoverflow.com/questions/54072656/storybook-addon-knobs-callback-function-knob
The text was updated successfully, but these errors were encountered: