Replies: 23 comments 11 replies
-
Hey! Thank you for your feature suggestion! This is something we want to add in the future, but I can't give you an ETA on it yet. Will keep this issue open, thanks for the suggestion! |
Beta Was this translation helpful? Give feedback.
-
+1 for multi-selection w/ |
Beta Was this translation helpful? Give feedback.
-
I also needed a multi-selection Listbox, here's a quick mockup: https://codesandbox.io/s/headlessuireact-listbox-multiple-mockup-widh4 The mockup is basically only using a workaround for selecting and deselecting options including determining the |
Beta Was this translation helpful? Give feedback.
-
@parsch Thanks, I've done something similar in Vue. However, it always closes when clicking on a ListboxOption. Did you figure out any way to prevent that? |
Beta Was this translation helpful? Give feedback.
-
@frandiox You have to replace the default handling of |
Beta Was this translation helpful? Give feedback.
-
Thank you for posting your workaround @parsch! It's working beautifully for me in the codesandbox, but I'm unfortunately having a hard time replicating in v0.3.1 (I wouldn't expect you to maintain this -- just an FYI.) As best I can tell, |
Beta Was this translation helpful? Give feedback.
-
@RobinMalfait - I have the code for this done if you're interested. https://qc1f9.sse.codesandbox.io/listbox/multi if the modelValue is an array the logic automatically allows multi selection. Let me know if you want me to do PR. |
Beta Was this translation helpful? Give feedback.
-
@tctrautman I can reproduce your point when using |
Beta Was this translation helpful? Give feedback.
-
Hey thanks, thats great, but im a it confused, your link include multiple examples that doesnt exist in the actual package, did you code it yourself or i have missed something here? |
Beta Was this translation helpful? Give feedback.
-
Actually, the code provided by @parsch can be easily modified: Just create a separated ListBox Button and add like this: Here is the full Component: https://gist.github.com/landorid/f747c49342dd9eac1b89b251cbe39616 (Also added clickaway listener) |
Beta Was this translation helpful? Give feedback.
-
Would be good to support a multiple selection with tags like this example: https://codesandbox.io/s/headlessuireact-listbox-example-forked-2snzy
Note: the example have a glitch when you remove a selected person from the tag as it's just a concept test |
Beta Was this translation helpful? Give feedback.
-
The link started out with me fixing a bug in the package ( #285 ). Since I was in the code base I added the multiple selection logic to the code. The site was for me to be able to regression test. |
Beta Was this translation helpful? Give feedback.
-
@RobinMalfait I'm able to make multiselect work if I manage the selected options myself. The issue I'm running into is that One solution would be to create a prop that tells ListBox to not change the open state when an option is created. |
Beta Was this translation helpful? Give feedback.
-
can you please tell me how can I close the list by clicking outside? |
Beta Was this translation helpful? Give feedback.
-
I have used the code sandbox given in the above comment CODE: https://codesandbox.io/s/headlessui-react-listbox-multiple-mockup-forked-squ0eo?file=/src/App.js |
Beta Was this translation helpful? Give feedback.
-
has anyone been able to pull this off with Vue? I've gotten super close based on the react example, but when I don't let the options close the focus goes back to the button and it breaks the active reference (so no highlighting on hover) until I use the keyboard navigation again. I attempted to create a codesandbox for it, but it just keeps through that stupid import error 😠Will try again a little later. |
Beta Was this translation helpful? Give feedback.
-
The same multiselect mockup is not working with Typescript and headless ui 2.5.0. https://stackoverflow.com/questions/71406838/typescript-headless-ui-listbox-open-close-management which is making the listbox closing at every selection. Any suggestion on this would be helpful. |
Beta Was this translation helpful? Give feedback.
-
+1 for multi-select on listbox. We use multi-select comboboxes extensively in our admin portal and this is a must-have feature for us. |
Beta Was this translation helpful? Give feedback.
-
+1 on multi-select please. |
Beta Was this translation helpful? Give feedback.
-
Wouldn't that just be the Combobox? |
Beta Was this translation helpful? Give feedback.
-
The multi value Listbox and Combobox features are already implemented and will be available in the next release. You can install the insiders build to test it out! |
Beta Was this translation helpful? Give feedback.
-
Wonderful, thank you
…On Tue, Apr 12, 2022, 12:41 PM Robin Malfait ***@***.***> wrote:
There is no documentation yet (hence why it's not released yet). But you
enable it by providing an array to the value property instead of a single
value.
An example can be seen here:
-
https://github.com/tailwindlabs/headlessui/blob/main/packages/playground-react/pages/listbox/multi-select.tsx
-
https://github.com/tailwindlabs/headlessui/blob/main/packages/playground-react/pages/combobox/multi-select.tsx
—
Reply to this email directly, view it on GitHub
<#668 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE6WVSWPOY6ZR7QQDCBRG3VEWRUJANCNFSM5BP3NVTQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
When this will be released? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm already using the Listbox for a single selection option. Looks and functions well. Would like to be able to reuse this component for a multiple selection as well with the existing OOTB code. Although, I can add the aria-multiselectable option. The existing button doesn't support this feature.
Beta Was this translation helpful? Give feedback.
All reactions