Often, you want the user to choose n options (where n is small-ish) from a very large (hundreds or thousands) number of possibilities. Good UX around this dictates that the user should be able to search for the options they want.
This gist puts together a minimal example of binding a search field with multiple checkboxes using ipywidgets.
widget = multi_checkbox_widget(['hello', 'world'])
widget # Display the widget
To get the selected options:
selected_options = [widget.description for widget in w.children[1].children if widget.value]
-
This is in need of some layout/CSS TLC.
-
At the moment, we just use difflib from the standard library for searching through the options. It mostly works, but I don't think it's what difflib is supposed to be used as. Using a different search algorithm might lead to better results.
Thanks a lot! Do you see a possibility adding
layout={'flex-flow': 'flex-wrap'}
instead of{'overflow': 'scroll'}
? Currently I just get a long list using your implementation and nothing to scroll.Flex-Flow-Reference