-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 multi
value support for Listbox & Combobox
#1243
Conversation
This pull request is being automatically deployed with Vercel (learn more). headlessui-vue – ./packages/playground-vue🔍 Inspect: https://vercel.com/tailwindlabs/headlessui-vue/5zXQCbNiXoU9rQEAeLF6ukyGrwNA headlessui-react – ./packages/playground-react🔍 Inspect: https://vercel.com/tailwindlabs/headlessui-react/Demym8B8Ba312zpotLkuFuUpQFCf |
53cac4f
to
5880f0c
Compare
5880f0c
to
75a3f84
Compare
c1d5312
to
47ee6a8
Compare
caa9313
to
388e143
Compare
388e143
to
8285922
Compare
8285922
to
74f05d7
Compare
This is fantastic news - looking forward to having this merged in. Thank you for all your hard work with Headless UI 🙏 |
This PR couldn't have come at a more perfect time! |
2d14148
to
3efd792
Compare
On vercel, getting a strange issue like `TypeError: undefined is not an object (evaluating 'r.resolveTarget')` which doesn't happen locally or once published. Would expect it to be `null` since we default to `null`. Hopefully this fixes things.
`@types/react-dom` hardcoded the `@types/react` to version `16.14.21` instead of using the latest `16.14.24` resulting in type mismatches. *cries in inconsistency*
3efd792
to
c9feb67
Compare
This is a first step in refactoring everything where we use dedicated actions and data instead of accessing the reducer state directly. It also allows us to get rid of mutations in render where we updated some values in render directly which is not ideal.
Oh I'm singing out of happiness! |
When can we expect to see this in an official release? |
So happy to see this. Thank you so much for the hardwork guys, this was much much needed! ❤️ |
for people wondering what happened, it is in the insiders release: |
Hey just wondering, if the multi select Listbox is in yet as for now (React) |
This PR will add
multiple
values support for both theListbox
andCombobox
components.You can enable multiple value support by providing an array of items instead of a single value. When the
value
is an array, we automatically switch to multiple value mode.This has a few implications:
v-model
in Vue, and theonChange
in React will now be an array.You can play with it here:
Closes: #648
I see a lot of reactions on this PR which makes me happy! If you already want to play with it:
npm install @headlessui/react@insiders
oryarn add @headlessui/react@insiders
.npm install @headlessui/vue@insiders
oryarn add @headlessui/vue@insiders
.The documentation is in the works, but to enable multi-support is by providing an array of options to the
value
orv-model
instead of a single item. TheonChange
in React would then be called with an array that can override your own state. (internally we already do the toggling of items for you). Similar in Vue, thev-model
can be used as-is out of the box.