pythonuser-interfaceflet

How to make combobox in flet?


I'm working on small chat app and frontend of it written in Flet. I would like to add search functionality with following flow:

In simpler terms, I would like to have good old combobox, and as of now, I dont see any ft.ComboBox or similar GUI objects in flet lib.

So, how do I implement that?


Solution

  • flet.Dropdown has additional parameters: editable, enable_search, enable_filter. Set them to True as in code bottom:

        dd = ft.Dropdown(
            editable=True,
            enable_search=True,
            enable_filter=True,
            width=200,
            options=[
                ft.dropdown.Option("Red"),
                ft.dropdown.Option("Green"),
                ft.dropdown.Option("Blue"),
            ]
        )