Hey, what do you think of adding type definition support in this select dropdown? #29034
FrancoAguzzi
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
Being a problem or not depends on the eyes of the seer.
The support I'd love to see is this Select Dropdown being a way of people defining default typed object properties values.
Describe the solution you'd like
How?
Nowadays, defining typed objects is a challenge for me.
I am not the only one? IDK -- maybe I didn't find the way to do so?
The desire: typed objects setting via Storybook UI.
The gap: object controls in Storybook UI are ruleless as per my raw Storybook knowledges.
The solution I found: setting
optionsandmappingobjects for these options that are for sure objects of the property type.The problem with the solution: I cannot initialize my
.storiesUI documentation with some value included in theoptionsarray, resulting in "Choose option..." label display in Select dropdown default option.How I wished to fix this?: by using
renderfunction, I tried to mutate price to be the first value ofoptionswith the below code snippet:Why my approach did not work?: because
SingleSelectStorybook component definesselectedKeyonly at render execution. Onvalueupdate,SingleSelectdoes not updateselectedKeybecauseselectedKeyis a defined asconst.How could this be different?: if
selectedKeywas a state (useState) and Storybook had anuseEffectwith the dependency array as[value], whenevervalueis modified,selectedKeywould be modified as well.Describe alternatives you've considered
OK, no more over-ideating now, what do you think about supporting creators to manage
SingleSelectcontrols, programatically?I appreciate your attention,
Wish you have a great time 🍞🙏🏼
Are you able to assist to bring the feature to reality?
yes, I can
Additional context
I'd be comfortably realized to open a PR with this proposed enhancement for your lib 🙂
Beta Was this translation helpful? Give feedback.
All reactions