I'm trying to migrate from Knobs to Controls and I am having trouble with nested objects.
As an example, lets say I have an object like this as props for a Component...
object : {
properties: {
color: 'black',
size: '1'
}
}
The project uses .tsx extensions for story files, no MDX as of now. I've tried accessing the nested properties like this to customize their Control...
Card.argTypes = {
object: {
properties: {
color: {control: {type: 'color'}},
size: {control: {type: 'range', options:{min:1,max:5,step:1}}}
}
}
}
But the control remains an object field with the entirety of the JSON right in there, which is not user friendly, you might agree.
Is there a way to access objects to give control over their nested properties? Given the size of the project, I can't go around flattening all the objects and their props in the components.
Thanks!
Not at present.
There's an open issue about it currently aimed at the 6.2 release.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With