Conversation
docs: Add anchor tag to /kitchen-sink/#form
…nd add it if it does not exist
|
Nice. My main issue with your approach is that you're serializing the values. The native multi-select would just send multiple values. I don't think I want to depart from native HTML behaviors. I'm reworking your solution as I need a multi-select field in devpu.sh. I'll report back here asap. |
|
I do want to support the more complex visualization/interaction with chips at some point, but I'm gonna ship a simpler version for now. This one works with what we already have with limited changes. CleanShot.2026-01-03.at.15.23.04.mp4 |
|
Shipped in I will provide an implementation for the chips, but it will be built with some custom JS/CSS off of the current component. I don't think I will ship this as a core component in Basecoat. |
|
I'll have.a poc for the full chips + remove button later on this week. For this I need to allow the select component to define custom triggers. Not hard, but need to be careful what I ship. I have a rough idea how. |
|
After testing, I realized that serializing the values is way more robust as well, but in the front-end and backend. You were right @sebastiangrill. Shipped it in Still holding off on the more complex visualization but I have a plan. |
|
i'm a big fan of searchable, clearable (all items), tag/pill (with individual click to clear) multiselect components. really appreciate the efforts on this |
|
Actually, most of it is already there:
I will create a meta component that uses the current multi-select but displays selected items as chips with a close icon and tie it all together. I don't want it to be implemented as part of core though, because it requires a lot more logic. |
|
Thanks a lot. I have tried it for a few days and it looks good. Covers around 80% of my use cases. |
Oh that's no good. I'm gonna fix that.
I'll try and get something out this week. |
|
Wait, the component is sending an event though, no? You should see I know it's not a native change event but I've tried a lot of different approaches and the serialized hidden input was the best tradeoff. |
|
Ah sorry for the confusion, yes the component is sending an event. |
Hey,
I am using basecoat and I needed a multiselect feature for my current project so I extended the current select to support it.
My JS skills are pretty limited so I probably did some unconvential (wrong) things.
Relevant: #99
Please give me some feedback and I can make adjustments.
I have added a few new data options:
Listbox Data Attributes
aria-multiselectable -> This has to be set true to indicate this is a multi-select component
data-multiselect-threshold -> Threshold beyond which selected items are condensed into a count display instead of showing individual badges
data-multiselect-threshold-text -> Custom text to append after the count when threshold is exceeded (e.g., "items chosen"), defaults to entries selected
data-multiselect-closetext -> A button is added to the listbox with the text 'clear' that clears all options displayed. This changes the text
aria-controls -> ID of an external element to populate with selected items (instead of using the default
selectedLabel)Option Data Attributes
Every option has to have an aria-selected or it is ignored: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-multiselectable#used_with_aria-selected
data-multiselect-variant -> Badge styling variant. Allowed values: 'secondary', 'destructive', 'ghost', 'outline'. If an invalid variant is specified or none is provided, it defaults to 'primary'.
data-multiselect-display -> ID of a element to display instead of a badge. When set, this element is cloned, the hidden attribute removed and used as the display rather than creating a badge. The referenced id can be anywhere.
JS change event
The multiselect sends all current checked values in the change event as a JSON Array
Example