Skip to content

st.selectbox and st.multiselect strict matching to user input #7238

@CHerSun

Description

@CHerSun

Checklist

  • I have searched the existing issues for similar feature requests.
  • I added a descriptive title and summary to this issue.

Summary

Please, add an option to select matching. Some possible variants:

  • loose / fuzzy (current default)
  • starts with
  • contains

Also might be a good option to include case sensitivity.

Personally, I need a toggle between loose / strict contains matching.

Why?

On most use cases current fuzzy matching works awesome.

But recently I've started working a lot with IDs (parts with specific part number). Problem is - IDs are quite similar, often a difference comes in single character. Current matching gives several variants, sometimes even placing wrong one in the first place. It makes it very easy for the end user to make a mistake (which shouldn't happen, as he is meant to copy/paste the ID most of times). With exact contains that wouldn't be a problem at all, items would've been filtered correctly (the same ID can't be present in another entry).

How?

Add an option to st.selectbox and st.multiselect, something like match: Literal['fuzzy']|Literal['contains']... with default being the current matching mechanics.

Update: Maybe a Callable form would be nice, running that onto collection to leave only wanted choices. This would allow user logic, like filtering based on certain field.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:st.multiselectRelated to the `st.multiselect` widgetfeature:st.selectboxRelated to the `st.selectbox` widgettype:enhancementRequests for feature enhancements or new features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions