SamF
SamF2mo ago

Searchable drop-down?

Hi everyone, I have the following ui element:
person_selection = mo.ui.dropdown(
options=dict(df.select(['name_full', 'person_id']).iter_rows()),
value="John Smith",
)
person_selection = mo.ui.dropdown(
options=dict(df.select(['name_full', 'person_id']).iter_rows()),
value="John Smith",
)
The selection is used to show plots related to the person selected from the menu. Is there a better way to do this for large numbers of people? df has thousands of unique records. It feels like I should be able to type a first or a last name into some mini search box and have those options appear. Thank you for your time!
Solution:
Yea -- can you try mo.ui.multiselect? That lets you type into it: https://docs.marimo.io/api/inputs/multiselect.html#marimo.ui.multiselect
Jump to solution
4 Replies
Solution
Akshay
Akshay2mo ago
Yea -- can you try mo.ui.multiselect? That lets you type into it: https://docs.marimo.io/api/inputs/multiselect.html#marimo.ui.multiselect
SamF
SamFOP2mo ago
Awesome, this works great. Is there some way to enforce at most one selection is chosen?
Akshay
Akshay2mo ago
Yea, there’s a max_selections param Described on the doc page i think
SamF
SamFOP2mo ago
Perfect thank you!