Skip to main content

Flyout

A Fluent flyout: a light popup attached to content, opened and closed with open.

Example:

def toggle(e):
flyout.open = not flyout.open


flyout = fluent.Flyout(
content=fluent.Button("Empty cart", on_click=toggle),
flyout=ft.Text("All items will be removed. Do you want to continue?"),
)
Flyout
Flyout

Inherits: LayoutControl

Properties

Events

  • on_dismiss - Called when the flyout is closed other than by setting open to False: by the user, or by resizing the window.

Example​

Fluent Flyout​

Sourceplay_arrowTry Online
import flet_fluent_ui as fluent

import flet as ft


def main(page: ft.Page):
page.title = "Fluent Flyout"

def open_flyout(e: ft.Event[fluent.Button]):
flyout.open = True

def empty_cart(e: ft.Event[fluent.Button]):
flyout.open = False
cart.value = "Your cart is empty"
empty_button.disabled = True

cart = ft.Text("3 items in your cart")
empty_button = fluent.Button("Empty cart", on_click=open_flyout)
flyout = fluent.Flyout(
content=empty_button,
flyout=ft.Column(
tight=True,
width=240,
controls=[
ft.Text("All items will be removed. Do you want to continue?"),
fluent.Button("Yes, empty my cart", on_click=empty_cart),
],
),
)

page.add(ft.SafeArea(content=ft.Column(controls=[cart, flyout])))


if __name__ == "__main__":
ft.run(main)
flyout
Confirming in the flyout empties the cart

Properties​

contentinstance-attribute​

content: Control

The control the flyout is attached to.

dismiss_on_pointer_move_awayclass-attributeinstance-attribute​

dismiss_on_pointer_move_away: bool = False

Whether the flyout closes when the mouse pointer leaves both the flyout and content.

dismissibleclass-attributeinstance-attribute​

dismissible: bool = True

Whether clicking outside the flyout, or pressing Escape, closes it.

flyoutinstance-attribute​

flyout: Control

The control shown in the popup.

openclass-attributeinstance-attribute​

open: bool = False

Whether the flyout is shown.

Resizing the window closes the flyout, which calls on_dismiss.

placementclass-attributeinstance-attribute​

Where the flyout opens relative to content.

Events​

on_dismissclass-attributeinstance-attribute​

on_dismiss: ControlEventHandler[Flyout] | None = None

Called when the flyout is closed other than by setting open to False: by the user, or by resizing the window.

open is set to False before this is called.