-
-
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
Pass ints into select knob #4402
Comments
when looking at the types for knobs i found SelectType.propTypes = {
knob: PropTypes.shape({
name: PropTypes.string,
value: PropTypes.string,
options: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
}),
onChange: PropTypes.func,
}; is there a reason why value needs to be a string here? |
Which version are you using? I think this was fixed in the alpha. |
Which should go release candidate monday. |
I'm on |
I'm on |
This works for me in 4.0.0: const numbers = {
one: 1,
two: 2,
four: 4,
};
const myNumber = select('Number', numbers, 1);
console.log(myNumber); // -> 1 |
What are you exactly trying @sapkra ? |
I tried exactly your example and I'm getting the following error.
But when I change the This is the line which only accepts a |
Ah, will fix! |
@ndelangen
I think that the problem is now the following line. |
Bug or support request summary
I believe this is a bug... could possibly be a feature request.
I have an object i want to convert into a select options. That object is structed like so
i'm converting it to what i believe is a correct object for the select knob doing this
the resulting object is
{0: "flush", 1: "flat", 4: "raised"}
When i try to pass this into my component that is expecting a number prop i get this error
elevation={select('Elevation Level', options, ELEVATIONS.flat)}
I expected that I could have numbers be selected without having them converted into strings
Please specify which version of Storybook and optionally any affected addons that you're running
It would be amazing if we could have a more thorough select option, maybe something structured like
edit: the error message got formatted so here is a screenshot
The text was updated successfully, but these errors were encountered: