ComboBox
A Fluent combo box: a button that opens a list of options to pick one from.
Example:
fluent.ComboBox(
placeholder="Pick a color",
items=[
fluent.ComboBoxItem(value="red", text="Red"),
fluent.ComboBoxItem(value="green", text="Green"),
fluent.ComboBoxItem(value="blue", text="Blue"),
],
)

Inherits: LayoutControl
Properties
autofocus- Whether this combo box should be focused on initial display.error_text- An error message shown in red below the combo box.expand_to_fit- Whether the closed combo box fills the width it is given, instead of fitting its widest option.items- The options to choose from.placeholder- The hint shown while no option is chosen.value- Thevalueof the chosen option.
Events
Example
Fluent ComboBox
import flet_fluent_ui as fluent
import flet as ft
def main(page: ft.Page):
page.title = "Fluent ComboBox"
def handle_change(e: ft.Event[fluent.ComboBox]):
status.value = f"Color: {e.control.value}"
status = ft.Text("No color chosen")
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
fluent.ComboBox(
placeholder="Pick a color",
on_change=handle_change,
items=[
fluent.ComboBoxItem(value="red", text="Red"),
fluent.ComboBoxItem(value="green", text="Green"),
fluent.ComboBoxItem(value="blue", text="Blue"),
],
),
status,
],
)
)
)
if __name__ == "__main__":
ft.run(main)

Properties
autofocusclass-attributeinstance-attribute
autofocus: bool = FalseWhether this combo box should be focused on initial display.
error_textclass-attributeinstance-attribute
error_text: str | None = NoneAn error message shown in red below the combo box.
Set it to tell the user that the value is not valid, and set it to None
to hide it.
expand_to_fitclass-attributeinstance-attribute
expand_to_fit: bool = FalseWhether the closed combo box fills the width it is given, instead of fitting its widest option.
itemsclass-attributeinstance-attribute
items: list[ComboBoxItem] = field(default_factory=list)The options to choose from.
placeholderclass-attributeinstance-attribute
placeholder: StrOrControl | None = NoneThe hint shown while no option is chosen.
valueclass-attributeinstance-attribute
value: str | None = NoneThe value of the chosen option.
If None, placeholder is shown.
Events
on_changeclass-attributeinstance-attribute
on_change: ControlEventHandler[ComboBox] | None = NoneCalled when the chosen option changes.
The data property of the event handler argument
contains the new value.
on_closeclass-attributeinstance-attribute
on_close: ControlEventHandler[ComboBox] | None = NoneCalled when the list of options closes.
on_openclass-attributeinstance-attribute
on_open: ControlEventHandler[ComboBox] | None = NoneCalled when the list of options opens.