Skip to content
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

Multi-Listbox #648

Closed
wants to merge 1 commit into from
Closed

Conversation

pvanliefland
Copy link
Contributor

Hey there,

Just a first attempt/POC for a multi-select Listbox (see #181).

React-only at this stage.

Screen.Recording.2021-06-29.at.00.46.56.mov

It involves a few changes, mostly:

  • Tracking the value in theListbox state, to be able to detect selected options while the Listbox is open
  • Checking here and there if value is an array
  • Focus handling

All in all, it seems to work ok, the only thing I can't get around is that when you use clickable items within Listbox.button (ex: badges with a remove action), the button gain focus on click, and it kind of messes things up.

I've added a basic test case - just a start.

Let me know if you'd like me to explore / improve this further, or if you prefer to handle this yourself :)

@vercel
Copy link

vercel bot commented Jun 28, 2021

@pvanliefland is attempting to deploy a commit to the Tailwind Labs Team on Vercel.

A member of the Team first needs to authorize it.

@gaa521
Copy link

gaa521 commented Aug 4, 2021

this looks awesome. @RobinMalfait can we please include this next release. It is kind of most wanted feature.

@Talch87
Copy link

Talch87 commented Aug 18, 2021

is this going to be approved? I really need it

@doutatsu
Copy link

doutatsu commented Sep 8, 2021

Bumping this up

@CricketLaChica
Copy link

@pvanliefland Looks like @StreamlineBrett approved this, but we might need to resolve the conflicts first as it's been a while. Right now I'm using a forked version of headlessui just to be able to use this, but would be great if we can merge the PR to the main project! Let me know if I can help. 🙏

@eriktisme
Copy link

@RobinMalfait any plans on merging this?

@pvanliefland
Copy link
Contributor Author

@CricketLaChica sorry, I haven't had the time to do any more work on this. I could dedicate a few hours to it if there is a clear interest from the authors.

@abetoots
Copy link

abetoots commented Oct 5, 2021

@RobinMalfait really a wanted feature, please? clearly a lot of interest from #181 as well

@adidoes
Copy link

adidoes commented Oct 25, 2021

any progress on this?

@RobinMalfait RobinMalfait deleted the branch tailwindlabs:main November 8, 2021 10:18
@doutatsu
Copy link

doutatsu commented Nov 8, 2021

@RobinMalfait Is closing this means it's coming or it's not going to come any time soon? 👀

@RobinMalfait
Copy link
Member

@doutatsu no, closing this means that I made a booboo and therefore GitHub decided to close all open PRs 🙃

@RobinMalfait RobinMalfait reopened this Nov 8, 2021
@RobinMalfait RobinMalfait changed the base branch from main-0 to develop November 8, 2021 11:45
@diego-lipinski-de-castro

Any updates? I think a lot of people want this asap

@ChrisGV04
Copy link

I'm really hoping this feature gets added soon! I would use it very often

@sebastibe
Copy link

How can we help to get this branch merged?

@CricketLaChica
Copy link

I'm willing to pitch in help as well, let me know please. Our team's been using this feature.

@doutatsu
Copy link

+1 From me as well - I had to implement a very basic alternative, but I'd love something more polished like in this PR

@dukkee
Copy link

dukkee commented Dec 1, 2021

+1 we wait for a new release with this feature

@PudparK
Copy link

PudparK commented Dec 22, 2021

+1 more for this feature. I could totally use this right now. 🙏🏼

@ngajhede
Copy link

Any news on this?

@james-bowers
Copy link

Really looking forward to this 🙌🏼

@RobinMalfait RobinMalfait changed the base branch from develop to main January 17, 2022 13:05
@johnsonthedev
Copy link

damn I always get an heart attack when Robin closes this PR 🤣🤣

@RobinMalfait
Copy link
Member

@johnson444 We will get to this PR, but I trusted GitHub's You can safely remove this branch when I closed #1039 but it closed a dozen PRs instead of changing the base 😓

@beeirl
Copy link

beeirl commented Feb 22, 2022

Any update on this one?

@brandonleichty
Copy link

Really really hoping to see this merged soon 🤞🤞🤞

@dukkee
Copy link

dukkee commented Mar 11, 2022

Hey, @RobinMalfait any updates on this PR? if you need help with merge conflicts, you can just write about it and we will help

@RobinMalfait RobinMalfait self-assigned this Mar 11, 2022
@frndchagas
Copy link

I´ve read all posts about this and decided to implement myself, until I saw this...

RobinMalfait self-assigned this yesterday

It´s better to wait ^^

@RobinMalfait
Copy link
Member

Yep I started a new pr with multi support for Listbox and Combobox components for both React and Vue based on this PR as a starting point. Going to continue on it next week. It's coming!

@RobinMalfait
Copy link
Member

Thank you for your initial work, @pvanliefland.

I continued on your work in #1243 where I also implemented multi select for the Listbox in Vue. But also for the Combobox in both React and Vue.

I started from your PR so that you are still marked as a contributor.


This will be available in the next release.

You can already try it using:

  • npm install @headlessui/react@insiders or yarn add @headlessui/react@insiders.
  • npm install @headlessui/vue@insiders or yarn add @headlessui/vue@insiders.

@AHBruns
Copy link

AHBruns commented Mar 16, 2022

So, this is awesome, and I think it's worth merging as is, but there does seem to be some sort of bug around scrolling. Using your example (https://headlessui-react-git-multi-value-support-tailwindlabs.vercel.app/combobox/multi-select). If I select one of the top options then quickly scroll down to the bottom, it will wait a moment then jump me to the top which is a bit disorienting. @RobinMalfait

@pvanliefland
Copy link
Contributor Author

Awesome @RobinMalfait , glad I could help!

@RobinMalfait
Copy link
Member

@AHBruns

This should be fixed by #1264, and will be available in the next release.

You can already try it using:

  • npm install @headlessui/react@insiders or yarn add @headlessui/react@insiders.
  • npm install @headlessui/vue@insiders or yarn add @headlessui/vue@insiders.

If you experience other issues, please open a new issue instead of commenting on this PR otherwise there is a (big) chance that I miss them 😅

@arezookheirabedi
Copy link

tank you @RobinMalfait
would you please code how using multi select in sandbox example

@erfurtjohn
Copy link

erfurtjohn commented Apr 26, 2022

@RobinMalfait thanks for updating the wiki.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.