rob-balfre / svelte-select

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

Hovered default (start on a certain item) #606

Closed EskelCz closed 1 year ago

EskelCz commented 1 year ago

I have a long list of items (languages), sorted alphabetically. The select shouldn't have a pre-set value, but I know that which language will most users want. I'd like to help them out be hovering that item/language first, although it's now first in the list. To start on a certain index somehow.

Is there a way to do that? I've noticed there is a hoverItemIndex prop, but from my testing it didn't seem to do anything.

Thanks for any ideas.

rob-balfre commented 1 year ago

Maybe groupBy might work.

Popular item 1 item 2 All item 3

https://github.com/rob-balfre/svelte-select#items

BUT if you REALLY want to set it manually you can with this little hack... https://svelte.dev/repl/78038217721944c49e445a043db67292?version=3.47.0

EskelCz commented 1 year ago

Thanks, that works for me