rob-balfre / svelte-select

Svelte Select. A select component for Svelte
https://svelte-select-examples.vercel.app
Other
1.27k stars 180 forks source link

Toggle selection #359

Closed ashtyn3 closed 2 years ago

ashtyn3 commented 2 years ago

on:select binding only works if item hasn't been select yet. Is there a way to allow the event to fire even if it has been selected. Like a toggle?

rob-balfre commented 2 years ago

@ashtyn3 not baked in no, you'd need to create reactive statements that listened to value and listOpen. Or you can replace the Item component and handle the events yourself.

ashtyn3 commented 2 years ago

@rob-balfre Could I get an example? I am new to svelte...

rob-balfre commented 2 years ago

@ashtyn3 here ya go https://svelte.dev/repl/f2db1a265bae4f64976f9d24d7b7f996?version=3.12.1

Replaced Item.svelte and added a store to communicate changes.

ashtyn3 commented 2 years ago

@rob-balfre Thank you so much!