-
Notifications
You must be signed in to change notification settings - Fork 82
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
[combo-box] Multi-select #1388
Comments
Will this feature look/work similar to this (unfortunately outdated) component? |
Most probably yes, the selected values would be presented as “chips” or “tokens” in the input. The linked component is slightly different, as it only offers suggestions, and the combo box offers a selectable list of options without having to type anything. But we are also considering adding/doing an “suggest” type of feature. |
"suggest" would be a "+1" from me :) |
Looks very nice! |
Custom value support is already implemented, and will be opt-in from 1.0.0-alpha6 onwards (a new property for controlling it is added). The plan is to make that work with multi-select as well, so we got you covered there :) |
Did anyone already implement the mulit-select? |
@tookit not yet. I’m sorry if my previous comment was misleading. What I meant was that multi-select is on the roadmap and coming up sometime after 1.0. |
+1 any idea when this will be implemented since we are on 1.1 now? |
Hi @jay8t6, thanks for the interest! Currently there are some other features prioritised over this one, namely vaadin/vaadin-combo-box#259 (custom filtering), vaadin/vaadin-combo-box#260 (lazy loading) and vaadin/vaadin-combo-box#106 (highlight filter matches). Also, before getting to multi-select, we would like to implement vaadin/vaadin-combo-box#165 (custom item templates), but that is pending some work by the core Polymer library. |
I am also looking for this feature. I have started making few changes to the combo box to support multiple selection but I see there is good amount of work.
Here is whet it looks like right now: |
+1 to @jimmyvithalani requirement |
Sorry for the long delay in updates regarding this issue. Thanks @jimmyvithalani for the concrete proposal and steps to actually implementing this. I have to admit, that we don’t have very concrete designs yet for this feature, how we would see it working, apart from the initial mockups Tuomas linked before. But your list and screenshot seem like a good starting point. The keyboard interactions will most probably require careful consideration and testing, which we haven’t discussed yet. About the roadmap: currently we can only promise that we will get this under development during next year. I know that’s a really lame promise, and doesn’t really give you a warm and fuzzy feeling inside that you might have to wait for this feature many months still 😔 I can definitely dedicate some time in refining the designs and functional requirements for this feature if someone is eager to take it under development. But I also fear, that since it’s quite a big feature, touching many parts of the code, the development team might want to be involved quite a lot in the implementation design. I don’t want to discourage anyone from going ahead and starting the implementation, but I think it would be great if you could share the work early and often to gather feedback from the core team. @Saulis, or others from the core team: how would you like to see this feature come up as a community contribution? |
We're always more than happy to receive contributions to the project, what's important to us of course, is that the implementation is aligned with the direction we'd planned to take it to. And the new feature needs to work cohesively with existing features like keyboard navigation, screen readers, custom values etc. So as @jimmyvithalani said, it's a fair amount of work to get done inside 4 weeks, especially when we don't currently have concrete designs complete yet. So for them, it's probably feasible to go ahead with their fork of the combo-box and change back to the vanilla combo-box once this feature is implemented. But as said, any help and input would be greatly appreciated! |
+1 |
Won’t happen for 2.0 (hybrid), and won’t make it to 3.0 (Polymer 2 version). But still very much going to happen eventually. |
Eagerly waiting for the update! |
This feature would be greatly appreciated |
Bumping this as it's a requirement for us to port some apps to Vaadin. Any ETA now that 4.0 has been released? Are there any mockups to preview how it'll look with Lumo? |
I have some old mockups I did for the Bakery starter, which contained a multi-select combo box. I’ll dig that up. I haven’t heard any plans yet that we would start implementing this. It has been on my personal “CF todo” for a while, but haven’t found the time to do anything. |
Here’s the current thinking regarding visual design: A couple of open questions regarding functionality:
|
Just my input based off of using something similar with Select2. It might be useful to emulate the functionality of Select2 or other JS library as most devs will be coming from something similar.
What do you do for current dropdowns? Not sure how hard it would be, but I would think that if the value is displayed (like List 1 above), it is displayed in the dropdown, but with the highlighted
I would say yes. Any "Clear All" would be a separate
Wrap - similar to a
I would only close |
Thank you Jouni for the update! In my opinion, the token/chip design is far too different from the default combo box: enabling a feature should not change the UX that much; such a design could be useful but I'd see more fit a different element for that. The default combo-box list already shows a check-mark for the selected item, then I'd expect just multiple check-marks if multi-selection is enabled. The content of the text-field then can be set with a custom function which takes the selected items as input, to output e.g. "5 items selected" (or the item itself for a single selection). For example: This way the UX won't change, the clear button clears the field value (e.g. empties the selection, as one would expect) and the field does not need to grow and occupy more space (or scroll) since it looks always the same, i.e. a With this in mind, here's my answers to your questions:
I'd say no, don't hide them: just show multiple check-marks and clicking an item with the check-mark will simply unselect it.
No, don't hide the clear button: it should clear the field value, e.g. unselect all items.
I'd prefer the component not to grow/wrap, but to behave like a text-field. |
@heruan I would have to disagree with your example. Just indicating that multiple items have been selected is easy for the developer, but not intuitive or informative for a user. If I had selected Argon and Xenon, they are way too far apart for me to easily discern that. This is a big issue if you are doing a "Pick 5 of X" or "Choose Your Top 3" type of element and want to have a select box and not several dozen or so checkboxes. Select2, Selectize.js, Semantic UI, and others are "chip-based" multiselects. Anecdotally, I see more chip-based being used in the wild than I do "items selected" style of multiselect. |
@moderndeveloperllc Of course, but you could always let the caption generator function to output the entire list of selected values instead of summarizing as "X items selected", e.g. so that you can either open the list and check/uncheck or you can "backspace" the items one-by-one (expecting a single backspace to clear the whole item, as it already happens for single selection). I'm not against a token/chip/tag container element, I just don't see it fit in |
Drafted an example on how this functionality could be built using the existing |
@heruan Nice feedback. I just want to add one point. One should be able to select all options at once. Currently once an option is selected, the dropdown goes away. Then one have again click on the text area for the dropdown to reappear. But when selecting multiple options, the user might want to select a large number of options from the dropdown. In this case clicking each time on the input area is cumbersome. |
@tomivirkki Great example on how to use I suppose the same approach could be also adopted to implement the design I proposed, but AFAIK currently there is no way to "check" more than one item in the dropdown menu; nor can the dropdown close behavior be intercepted to allow multiple selections at once, as @sudipta1411 suggested. Do you have any suggestion? I'd love to contribute to get a |
Hi @heruan, the combo-box itself allows only one selection at once, but you can setup the item |
Thank you for the suggestion! There's a last bit I'm missing: I can't find where/how in the code the checkmark for the selected item is set 😕 If the same checkmark can be set from the template, we're not that distant to a proper multi-select combo box! |
The checkmark is set by the theme, based on the That custom property is then used here: https://github.com/vaadin/vaadin-item/blob/master/theme/lumo/vaadin-item.html#L26 It’s definitely not clean or pretty, but it was pretty much the only nice way to implement it with the current API. A cleaner way would be to have an explicit |
Thank you @jouni, finally I see where the checkmark icon is defined! Still missing in my mind map the link connecting I'm not sure anymore this can be achieved with the same approach used in Tomi's fiddle. |
AFAIK vaadin-item and vaadin-combo-box-item are not linked in any way at the moment. They just happen to expose mostly the same styling API. |
Hi @jouni the design looks great. I too really like the token/chip design. I see this item has been open for quite a while, do you have any idea when it might be scheduled for release? I think it's a really important component to have when evaluating different web frameworks. @heruan it sound like you allows got a workaround going using the templating, would you be able to share the details? |
@Davidm76 I didn't get much far, as I got lost around the lines which create the item template (around vaadin-combo-box-item.html#L119): comboBox._ensureTemplatized();
if (comboBox._TemplateClass) {
this._itemTemplateInstance = new comboBox._TemplateClass({});
this.$.content.textContent = '';
this.$.content.appendChild(this._itemTemplateInstance.root);
} and I'm still unable to understand those! About the design, it seems I'm the only one which disagree with the chips: in my opinion multi selection should not change the UX that much (items disappearing, no more blue check marks on selected ones, invasion of chips…). But if you like that design, @tomivirkki implementation should already be usable as a new custom element: https://jsfiddle.net/heruan/7b1g1hr8/1 (fixed using Polymer 2). |
I hear you @heruan – the chips based design might a more specialized/configured element, and the out-of-the-box multi-select is more like you described. As the component’s value is a At some point, I was thinking about a way to define the field value template/renderer, so that it would be possible to configure the selected items to show as tokens instead of just a plain string inside the field. To hide the selected items from the overlay, we could filter out the selected values from the |
@Davidm76 yeah, this feature has been on the wishlist from the very beginning when we started to implement this component, but it keeps getting run over with other priorities (like migrating to Polymer 2, then Polymer 3, etc. 😜) Still can’t make any promises. The code base for this component is also not very pretty, so the team might want to pay some tech debt before starting to work on this kind of a big new feature. |
I have adapted @tomivirkki answer and created multi-select-combo-box based on vaadin-combo-box. You can check it here: https://github.com/selvinfehric/multi-select-combo-box It is adapted for Polymer2. It can be themed if you include material or lumo theme for vaadin-combo-box and vaadin-textfield. And you can pass it a list of primitives or objects and use display-field property to handle what is shown in the list. Those are changes to @tomivirkki's sample. It is published to webcomponents.org and you can see a demo here: Please report any issues and feel free to contribute! |
@selvinfehric Thanks! I've made a PR to upgrade your work to Polymer 3 using polymer-modulizer: #1 |
Hey guys. Very sorry in advance for this dumb question, but here goes... |
Inspired by the excellent discussion here and @tomivirkki's comment I have created a multiselect combo box component. The code is available on github and here is the link to the live demo↗ The component is published on webcomponents.org as well as in the vaadin directory. Please feel free to check it out and report any issues. Feedback and contributions are very welcome, thank you! |
This component looks awesome! Exactly what I need. I am new to Vaadin so I just came across this tutorial on how to wrap the web component with Java API. So I'm about to try it out. Before I go down that path, just thought I'd ask first...is there any plan on adding this component as a Maven dependency with Java API? If so, I'll just use that. I didn't notice any Maven documentation on the Vaadin Directory site. |
Hi @gatanaso I believe I'm almost there, but I'm not sure how to set the actual items yet. I was able to set the selectedItems property, but when I tried similar for "items" it's not working. I'll keep trying, but let let me know if you have some suggestions. Sorry, for dumb questions. Totally new to this and still learning the architecture. Thanks! |
Hi @twferrell, I am glad the component fits your needs. At the moment, this is only a web component with no Java integration. I am planning to integrate it to Flow as soon as I have more time available. |
@gatanaso great work on the component!! I did not know it existed. Nice work! |
I am happy to say that I've created the initial Vaadin Flow integration of the multiselect-combo-box web component 🎉 The code is available on github and the add-on has also been published to the vaadin directory. Please feel free to check it out and report any issues. Feedback and contributions are very welcome, thank you! |
Are there any updates on this issue? It would be nice to have first-party support for this. |
@bramceulemans this feature is not in the short term backlog at the moment. However, multi select combo box is one of the improvements that we keep in mind, and it might be that we include it to the next generation components (that will be built with LitElement). |
@bramceulemans While we wait to see if this component will get multiselect, I have had good results with @gatanaso's https://github.com/gatanaso/multiselect-combo-box/. He just merged in a fix for what was my only quibble - a way to address the |
We have initial designs for this feature (mockups), but we need to write some end user scenarios to validate the designs (useful for user testing).
The text was updated successfully, but these errors were encountered: