Skip to main content

ExpansionPanel

A material expansion panel. It can either be expanded or collapsed. Its body is only visible when it is expanded.

Example:

ft.ExpansionPanelList(
width=400,
controls=[
ft.ExpansionPanel(
header=ft.Text("Shipping address"),
content=ft.Text("123 Market Street, Springfield"),
expanded=True,
),
ft.ExpansionPanel(
header=ft.Text("Billing address"),
content=ft.Text("Same as shipping"),
),
],
)
ExpansionPanel
Basic ExpansionPanel

Inherits: LayoutControl, AdaptiveControl

Properties

  • bgcolor - The background color of this panel.
  • can_tap_header - Whether tapping on this panel's header will expand or collapse it.
  • content - The control to be found in the body of this panel.
  • expanded - Whether this panel is in expanded (True) or collapsed (False) state.
  • header - The control to be found in the header of this panel.
  • highlight_color - Defines the highlight color of this panel if can_tap_header is True, or the highlight color of the expand/collapse IconButton if can_tap_header is False.
  • splash_color - Defines the splash color of this panel if can_tap_header is True, or the splash color of the expand/collapse IconButton if can_tap_header is False.

Properties

bgcolorclass-attributeinstance-attribute

bgcolor: Optional[ColorValue] = None

The background color of this panel.

can_tap_headerclass-attributeinstance-attribute

can_tap_header: bool = False

Whether tapping on this panel's header will expand or collapse it.

contentclass-attributeinstance-attribute

content: Optional[Control] = None

The control to be found in the body of this panel.

It is displayed below the header when this panel is expanded.

If this property is None, this panel will have a placeholder Text as content.

expandedclass-attributeinstance-attribute

expanded: bool = False

Whether this panel is in expanded (True) or collapsed (False) state.

headerclass-attributeinstance-attribute

header: Optional[Control] = None

The control to be found in the header of this panel.

It is always visible, regardless of whether this panel is expanded or collapsed. If can_tap_header is True, tapping on this header will expand or collapse this panel.

If this property is None, this panel will have a placeholder Text as header.

highlight_colorclass-attributeinstance-attribute

highlight_color: Optional[ColorValue] = None

Defines the highlight color of this panel if can_tap_header is True, or the highlight color of the expand/collapse IconButton if can_tap_header is False.

If this is None, then the icon button will use its default highlight color flet.Theme.highlight_color, and this panel will use its default highlight color flet.Theme.highlight_color (if can_tap_header is True).

splash_colorclass-attributeinstance-attribute

splash_color: Optional[ColorValue] = None

Defines the splash color of this panel if can_tap_header is True, or the splash color of the expand/collapse IconButton if can_tap_header is False.

If can_tap_header is False, and flet.Theme.use_material3 is True, this field will be ignored, as flet.IconButton.splash_color will be ignored, and you should use highlight_color instead.

If this is None, then the icon button will use its default splash color flet.Theme.splash_color, and this panel will use its default splash color flet.Theme.splash_color (if can_tap_header is True).