Skip to main content

InfoBadge

A Fluent info badge: a small colored dot or count that draws attention to something, such as new items.

Example:

fluent.InfoBadge("5")
fluent.InfoBadge(severity=fluent.InfoBarSeverity.ERROR) # a dot
InfoBadge
InfoBadge

Inherits: LayoutControl

Properties

  • bgcolor - The color of the badge, overriding severity.
  • color - The color of content.
  • content - The text or control in the badge, usually a count.
  • severity - The color of the badge: the accent color for INFO, or the attention, success or critical color.

Example​

Fluent InfoBadge​

Sourceplay_arrowTry Online
import flet_fluent_ui as fluent

import flet as ft


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

def mark_read(e: ft.Event[fluent.Button]):
unread.visible = False
status.value = "All caught up"

unread = fluent.InfoBadge("5")
status = ft.Text("5 unread messages")

page.add(
ft.SafeArea(
content=ft.Column(
controls=[
ft.Row(
controls=[ft.Text("Inbox"), unread],
),
ft.Row(
controls=[
ft.Text("Updates"),
fluent.InfoBadge(severity=fluent.InfoBarSeverity.ERROR),
],
),
fluent.Button("Mark all as read", on_click=mark_read),
status,
],
)
)
)


if __name__ == "__main__":
ft.run(main)
info_badge
Marking all as read

Properties​

bgcolorclass-attributeinstance-attribute​

bgcolor: ColorValue | None = None

The color of the badge, overriding severity.

colorclass-attributeinstance-attribute​

color: ColorValue | None = None

The color of content.

contentclass-attributeinstance-attribute​

content: StrOrControl | None = None

The text or control in the badge, usually a count.

If None, the badge is a small dot.

severityclass-attributeinstance-attribute​

The color of the badge: the accent color for INFO, or the attention, success or critical color.