Listbox component allow deselecting a single-select value #2152
Unanswered
slavatarsyurimi
asked this question in
Help
Replies: 1 comment
-
I dont know if this is good practice to do but i have this working with:
|
Beta Was this translation helpful? Give feedback.
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm currently tweaking around a Headless UI Listbox (Select) component in order to allow for empty values. This doesn't seem like a crazy feature to have. vue-multiselect for example exposes an
allowEmpty
prop.Making the input
modelValue
nullable and showing a placeholder when the value is empty seems to work out easy enough. However, once a value is selected it can't be deselected.The issue also disappears when allowing for select multiple items. In this case deselecting the last selected value works just fine. This, however, potentially raises another question - how would I go about preventing a user from deselecting the last selected item in a multiselect listbox component?
At the moment I cannot find any reference in the documentation for enabling or restricting empty selection. Does anyone have any insight in this?
Beta Was this translation helpful? Give feedback.
All reactions