m-wrzr / streamlit-searchbox

Streamlit searchbox that dynamically updates and provides a list of suggestions based on a provided function
MIT License
240 stars 31 forks source link

Use Creatable select instead. #19

Closed sfc-gh-pkommini closed 1 year ago

sfc-gh-pkommini commented 1 year ago

Fixes #18.

Changes

Testing

Was able to test the fix and get the searchterm itself added as one of the options that is submitted to mirror a google search like experience. Google search: Shows the search term as the first suggestion

image

My streamlit app shows the searchterm itself as a suggestion:

image

I used the code in this PR built using python setup.py sdist bdist_wheel command and then installing the wheel file into my streamlit app's conda environment.

@m-wrzr Let me know if you like to see any improvement or you're satisfied with the change.

sfc-gh-pkommini commented 1 year ago

@m-wrzr Could you please review and help get this merged into a release?

m-wrzr commented 1 year ago

Hey @sfc-gh-pkommini thanks for the PR, I built it locally and it works.

Adding the searchterm as an option is a good idea, but currently this can also be achieved by adding it as a first option to the search_function you pass. Would there be any benefits to using ReactCreatable over this approach?

Also, not every user might want to add the searchterm as a selectable option, so it would be good to have a flag that can be passed, similar to clear_on_submit since people have different usecases.

sfc-gh-pkommini commented 1 year ago

@m-wrzr I didn't realize I could achieve the same result from the function. Thank you. Closing the PR.