ContentDialog
A Fluent dialog: a window over the page that the user must deal with before going back to it.
Open it with Page.show_dialog and close it with
Page.pop_dialog, like AlertDialog.
Example:
page.show_dialog(
fluent.ContentDialog(
title="Delete file?",
content="The file will be deleted permanently.",
actions=[
fluent.FilledButton("Delete", on_click=delete),
fluent.Button("Cancel", on_click=lambda e: page.pop_dialog()),
],
)
)

Inherits: DialogControl
Example
Fluent ContentDialog
import flet_fluent_ui as fluent
import flet as ft
def main(page: ft.Page):
page.title = "Fluent ContentDialog"
def delete(e: ft.Event[fluent.FilledButton]):
page.pop_dialog()
# pop_dialog() sends its own update, so the page is not auto-updated
# after this handler; send the status change explicitly.
status.value = "File deleted"
status.update()
def cancel(e: ft.Event[fluent.Button]):
page.pop_dialog()
status.value = "Kept the file"
status.update()
dialog = fluent.ContentDialog(
title="Delete file?",
content="If you delete this file, you won't be able to recover it.",
actions=[
fluent.FilledButton("Delete", on_click=delete),
fluent.Button("Cancel", on_click=cancel),
],
)
status = ft.Text()
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
fluent.Button(
"Delete file", on_click=lambda e: page.show_dialog(dialog)
),
status,
],
)
)
)
if __name__ == "__main__":
ft.run(main)

Properties
actionsclass-attributeinstance-attribute
actions: list[Control] = field(default_factory=list)The buttons shown at the bottom, usually Button
and FilledButton controls. They share the width
of the dialog equally.
contentclass-attributeinstance-attribute
content: StrOrControl | None = NoneThe main content of this dialog.
modalclass-attributeinstance-attribute
modal: bool = TrueWhether the dialog stays open when the user clicks outside it.
The dialog can be closed with Esc either way.
openclass-attributeinstance-attribute
open: bool = field(default=False, kw_only=True)