-
Notifications
You must be signed in to change notification settings - Fork 85
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
Multiselect Combo Box: allow showing all labels #4625
Multiselect Combo Box: allow showing all labels #4625
Comments
We need the mscb auto expand to display full items too. There are many important reasons:
|
Screenreader already get all items 😉 |
I think this feature is coupled with the feature of wrapping the items on multiple lines, and allowing the input height to grow (can't find the issue now). |
@jouni That was mentioned in a somewhat unrelated issue: #4185 (comment) |
I don't like the way the selected items are wrapped in Goran's addon but collapsing the items makes the component quite painful to use. |
@jcgueriaud1 Issue you are looking for #4185 |
True, let's vote for these 2 issues. |
Is there any update regarding this issue? I would need something like MultiSelectVariant.SHOW_ALL_ITEMS, and then the component would show all or if i set sizeFull that the items would be displayed over whole size of comonent. |
Here's a CSS workaround to get the chips to wrap. It's far from the ideal solution as the input field within component ends up being very small. Dropdown icon is absolutely positioned which causes the clear button to be unusable. Also it doesn't yet solve the original issue of showing full item labels. vaadin-multi-select-combo-box[theme~="wrap-chips"][has-value] {
--input-min-width: auto;
}
vaadin-multi-select-combo-box[theme~="wrap-chips"][has-value]::part(chips) {
flex-wrap: wrap;
gap: var(--lumo-space-xs);
padding: var(--lumo-space-xs) 0;
max-width: calc(100% - var(--lumo-size-l) - var(--lumo-icon-size-m));
}
vaadin-multi-select-combo-box[theme~="wrap-chips"][has-value]::part(toggle-button) {
position: absolute;
right: var(--lumo-space-xs);
}
vaadin-multi-select-combo-box[theme~="wrap-chips"] input {
width: var(--lumo-size-l);
padding-right: var(--lumo-space-l);
}
vaadin-multi-select-combo-box[theme~="wrap-chips"] vaadin-multi-select-combo-box-chip {
overflow: hidden;
} |
Here's another variant with chip labels breaking to multiple lines. This one doesn't require absolute positioning, but has the same issues with input size. vaadin-multi-select-combo-box[theme~="break-chips"][has-value] {
--input-min-width: auto;
}
vaadin-multi-select-combo-box[theme~="break-chips"][has-value]::part(chips) {
flex-wrap: wrap;
gap: var(--lumo-space-xs);
padding: var(--lumo-space-xs) 0;
max-width: calc(100% - var(--lumo-size-l));
}
vaadin-multi-select-combo-box[theme~="break-chips"] input {
width: var(--lumo-size-l);
}
vaadin-multi-select-combo-box[theme~="break-chips"] vaadin-multi-select-combo-box-chip {
white-space: normal;
} |
This really is great. It's a progress! |
This CSS snippet is very close to what I needed. I think it'll be a very welcome addition to have a wrap-chips variant. I made a couple of additions to mine to hide the toggle arrow, move the input to the top and only show it once focused. vaadin-multi-select-combo-box.css
vaadin-multi-select-combo-box-container.css
Additionally, to enable focusing by clicking anywhere in the field, MultiSelectComboBox needs to be extended and this code is added to the constructor of the child class:
|
@alkali47 @juuso-vaadin Thanks! Should this work for Vaadin 24.2.0 ? I added 2 files: vaadin-multi-select-combo-box.css to themes\THEME_NAME\components folder but nothing happens.. |
Dear Vaadin Team, please incorporated the feature into the core library component. I have numerous pages in my application where I require its functionality. |
@alexanoid Did you also set the theme? |
@juuso-vaadin Oops! That was my mistake. Thank you for pointing it out. Now everything is working correctly! |
@juuso-vaadin But there is one issue - the multiSelectComboBox doesn't release the focus on the first click outside of the component. It only releases the focus on the second click. |
That's the intended behavior to allow multiple selection. Please don't spam this issue with unrelated question. Create a new issue, if you think you found one. |
If we allow showing all labels, it also creates a need for possible new API's. In many apps the labels in drop down can be long, and unpractical to show in the chips, where you probably want to show shorter version of the label. Hence one would need something like Consider this example
And corresponding CSS
|
I may be wrong but looks like it was released in version 24.3.0.alpha1. I upgraded to this Vaadin version but I am unable to see the new API for the MultiSelectComboBox. Could you please show how to use it in order to display all selected chips? |
The flow API is not included in the first alpha. The Vaadin Bot is probably commenting on the issue once that's released as well. Later it's probably going to be "setAllChipsVisible(true)". |
Yes, the comment above is correct. There will be alpha2 published soon and it will include |
Describe your motivation
Based on feedback: https://vaadin.com/forum/thread/18816965/p-vaadin-v23-2-0-includes-component-multi-select-combo-box-p
For me, for example, the new Vaadin mscb is not usable, because it doesn't provide option to always show full item labels.
There should be an option to not collapse the tags even if it might look awkward with a lot of selected items.
Describe the solution you'd like
Every selected item should be visible and not collapsed.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: