Expander
A Fluent expander: a header that shows or hides its content when
clicked.
Example:
fluent.Expander(
header="Advanced options",
content=fluent.Checkbox(label="Enable logging"),
expanded=True,
)

Inherits: LayoutControl
Properties
content- The control shown below (or above)headerwhile expanded.content_padding- The padding aroundcontent.direction- The direction the content opens in.expanded- Whethercontentis shown.header- The always-visible header.leading- An icon or control shown beforeheader.trailing- A control shown at the end of the header, before the chevron.
Events
on_change- Called when the expander opens or closes.
Example
Fluent Expander
import flet_fluent_ui as fluent
import flet as ft
def main(page: ft.Page):
page.title = "Fluent Expander"
def handle_change(e: ft.Event[fluent.Expander]):
status.value = "Expanded" if e.control.expanded else "Collapsed"
status = ft.Text("Collapsed")
page.add(
ft.SafeArea(
content=ft.Column(
width=400,
controls=[
fluent.Expander(
header="Advanced options",
leading=fluent.FluentIcons.SETTINGS,
on_change=handle_change,
content=ft.Column(
controls=[
fluent.Checkbox(label="Enable logging"),
fluent.Checkbox(label="Send diagnostics"),
],
),
),
status,
],
)
)
)
if __name__ == "__main__":
ft.run(main)

Properties
content_paddingclass-attributeinstance-attribute
content_padding: PaddingValue = 16The padding around content.
directionclass-attributeinstance-attribute
direction: ExpanderDirection = ExpanderDirection.DOWNThe direction the content opens in.
leadingclass-attributeinstance-attribute
leading: IconDataOrControl | None = NoneAn icon or control shown before header.
Events
on_changeclass-attributeinstance-attribute
on_change: ControlEventHandler[Expander] | None = NoneCalled when the expander opens or closes.
The data property of the event handler argument
contains the new expanded value.