mskocik / svelecte

Flexible autocomplete/select component written in Svelte,
https://svelecte.vercel.app
MIT License
469 stars 42 forks source link

Add filterSelections and hideSelections options #187

Closed raiyni closed 1 year ago

raiyni commented 1 year ago

From what I could tell, there was no canonical way to prevent filtering from the dropdown when multiple = true.

This adds a simple option to disable that behavior. A reason someone might want that ability is to use checkboxes as an on/off display.

I also didn't see a way to hide the selections part. When using a toggle field, like a checkbox, that selections part is way too much clutter. With that, selections also should probably be removed if they are clicked on again.

An example is added how someone might use checkboxes in the dropdown.

mskocik commented 1 year ago

I would say you are thinking about it wrong. Basically you are disabling all useful core svelecte's features and turn it into dummy checkbox list. Using Svelecte for that is just pure overkill.

It would be better if you had separate component for funcionality like this if you need it and not bend Svelecte to it. Actually not something I would like to have in the lib.

raiyni commented 1 year ago

I would argue that you are thinking about this PR the wrong way.

The features that you are considering useful core features are actually annoying and wasteful when it comes to a complete user experience. Ironically, the two options added by this PR bring this component more in line with what a normal user would expect out of a multiselect component.

I don't have to use this component but it was the most simple of the big 3 svelte multiselect components that looked to fulfill my needs. It's cool though.

mskocik commented 1 year ago

I agree with you on "bring this component more in line with what a normal user would expect out of a multiselect component.", but I consider it more an autocomplete than just multiselect.

Anyway... I couldn't merge it even if I wanted to, because WIP code is different from the latest master. But I will use this feature as blueprint, what should be possible to do out of the box in v4