Skip to main content

InfoBar

A Fluent info bar: an inline message about the state of the app, colored by its severity.

Example:

fluent.InfoBar(
title="Update available",
content="Restart the app to install it.",
severity=fluent.InfoBarSeverity.WARNING,
)
InfoBar
InfoBar

Inherits: LayoutControl

Properties

Events

  • on_close - Called when the close button is clicked.

Example​

Fluent InfoBar​

Sourceplay_arrowTry Online
import flet_fluent_ui as fluent

import flet as ft


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

def handle_close(e: ft.Event[fluent.InfoBar]):
e.control.visible = False

page.add(
ft.SafeArea(
content=ft.Column(
width=500,
controls=[
fluent.InfoBar(
title="Update available",
content="Restart the app to install it.",
action=fluent.Button("Restart"),
),
fluent.InfoBar(
title="Saved",
content="Your changes were saved.",
severity=fluent.InfoBarSeverity.SUCCESS,
on_close=handle_close,
),
fluent.InfoBar(
title="Low disk space",
content="Free some space to keep syncing.",
severity=fluent.InfoBarSeverity.WARNING,
),
fluent.InfoBar(
title="Sync failed",
content="Check your connection and try again.",
severity=fluent.InfoBarSeverity.ERROR,
),
],
)
)
)


if __name__ == "__main__":
ft.run(main)
info_bar
Info bars of every severity

Properties​

actionclass-attributeinstance-attribute​

action: Control | None = None

A control shown after content, usually a Button.

contentclass-attributeinstance-attribute​

content: StrOrControl | None = None

The text shown after title.

icon_visibleclass-attributeinstance-attribute​

icon_visible: bool = True

Whether the severity icon is shown.

longclass-attributeinstance-attribute​

long: bool = False

Whether content and action are shown below title instead of on the same line, for longer messages.

severityclass-attributeinstance-attribute​

The severity of the message, which sets the color and icon.

titleinstance-attribute​

title: StrOrControl

The title of the message.

Events​

on_closeclass-attributeinstance-attribute​

on_close: ControlEventHandler[InfoBar] | None = None

Called when the close button is clicked.

The close button is only shown when this handler is set. The info bar is not hidden automatically: hide or remove it in the handler.