rob-balfre / svelte-select

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

Show results with matching starting string on top #491

Closed planemad closed 1 year ago

planemad commented 1 year ago

Expected

When typing my search string, the top results would be those words that start with my typed string.

Actual

The top results are alphabetical, and i need to type more characters than expected to find my result.

Eg. Picking Tanzania from a country list requires typing tanz, but if it was ordered by matching starting string it would just need t

screen5

--

This is a very cool project ❤️ !

rob-balfre commented 1 year ago

You can use loadOptions a promise based method to return them sorted how you'd prefer.

v5 example here... https://svelte-select-examples.vercel.app/examples/props/loadOptions

planemad commented 1 year ago

Perfect, that would work! Thanks @rob-balfre