Skip to content
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

Add 'check' option in @storybook/addon-ondevice-controls #541

Open
simonadenic opened this issue Jan 22, 2024 · 6 comments
Open

Add 'check' option in @storybook/addon-ondevice-controls #541

simonadenic opened this issue Jan 22, 2024 · 6 comments
Labels

Comments

@simonadenic
Copy link

Is your feature request related to a problem? Please describe.
I have a need for a property to choose on/off from multiple options. Example: component has fontWeight property, which can be 'bold' or undefined. I need to have a selection between those two. This could only be properly represented by checking the 'bold' or unchecking it (as a value).

Describe the solution you'd like
I would like type:'check' in controls addon, just like on the web

Describe alternatives you've considered
I've considered using some of the options available such as 'select', but none of these match my use-case.

Are you able to assist bring the feature to reality?
No

Additional context
No additional context.

@dannyhw
Copy link
Member

dannyhw commented Jan 22, 2024

@simonadenic we have the boolean type, maybe that can work? However we can definitely add the check control type

@dannyhw dannyhw added v7 we're so back feature request labels Jan 22, 2024
@simonadenic
Copy link
Author

I tried the boolean type, but it doesn't correspond to my needs (since fontWeight true or false would need to be mapped to fontWeight='bold' or fontWeight=undefined in the component render). The type of my property is fontWeight?: 'bold'. Its defined like this to support future fontWeights planned (fontWeight?: 'bold' | 'bolder' | 'boldest' or something similar).

Anyhow, it seems that every optional property in the component would require the check type, rather than select, radio or any other :)

@dannyhw
Copy link
Member

dannyhw commented Jan 23, 2024

what you can do is map the type to the appropriate value by having a render function, though I understand that it would be better to add the control type. I will do that soon after v7 probably

@dannyhw
Copy link
Member

dannyhw commented Feb 10, 2024

So I've implemented something for this but I don't really know if it does what you want, it returns an array of the selected options, how would that work for your case?

@dannyhw
Copy link
Member

dannyhw commented Feb 10, 2024

please check #553 if you want to see the implementation, it's basically a copy of the web component

@hanwenbo
Copy link

hanwenbo commented Oct 9, 2024

error: Error: While trying to resolve module http from

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants