You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Select is hostaging a user into having a select value once selected. There is currently no easy (or intuitive) way for resetting the uncontrolled state of select.
Resetting the select value is a core feature of native select, and resorting to dirty hacks such as using the key prop is not ideal DX and can lead to unexpected behavior.
Current Behavior
Not able to set Select.Item value to empty string for resetting purposes.
Expected behavior
Be able to somehow reset the choice in uncontrolled <Select /> component, in a non-hacky way.
Reproducible example
Take a look at the example of this Select component, used for filtering search by fruit. If you'd wanted to filter only fruits with apples, then changed your mind and wanted to see all the fruits, you'd have to reload the page, or reset the entire form (losing other filters which you wished to stay) instead of just removing the value you don't wish to filter by.
This is annoying user experience, and a core feature of Select component that's missing!
<Select{...props}><Select.Trigger><Select.Valueplaceholder="Choose fruit"/></Select.Trigger><Select.Content><Select.Group><Select.Itemvalue=""className="opacity-50">Choose a fruit</Select.Item><Select.Itemvalue="apple">Apple</Select.Item><Select.Itemvalue="banana">Banana</Select.Item><Select.Itemvalue="orange">Orange</Select.Item></Select.Group></Select.Content></Select>
The code above is simple and clean, but currently throws the following error:
Error: A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.
Suggested solution
Be able to set Select.Item vlaue to an empty string <Select.Item value="" />, or
Have new primitive Select.Clear to reset the value of <Select />
The text was updated successfully, but these errors were encountered:
Bug report
Select is hostaging a user into having a select value once selected. There is currently no easy (or intuitive) way for resetting the uncontrolled state of select.
Resetting the select value is a core feature of native select, and resorting to dirty hacks such as using the key prop is not ideal DX and can lead to unexpected behavior.
Current Behavior
Not able to set
Select.Item
value to empty string for resetting purposes.Expected behavior
Be able to somehow reset the choice in uncontrolled
<Select />
component, in a non-hacky way.Reproducible example
Take a look at the example of this Select component, used for filtering search by fruit. If you'd wanted to filter only fruits with apples, then changed your mind and wanted to see all the fruits, you'd have to reload the page, or reset the entire form (losing other filters which you wished to stay) instead of just removing the value you don't wish to filter by.
This is annoying user experience, and a core feature of
Select
component that's missing!The code above is simple and clean, but currently throws the following error:
Suggested solution
Select.Item
vlaue to an empty string<Select.Item value="" />
, orSelect.Clear
to reset the value of<Select />
The text was updated successfully, but these errors were encountered: