CommandBar
A Fluent command bar: a toolbar of commands, with a "More" menu for commands that are used less often or don't fit.
Example:
fluent.CommandBar(
primary_items=[
fluent.CommandBarButton(icon=fluent.FluentIcons.ADD, content="New"),
fluent.CommandBarButton(
icon=fluent.FluentIcons.DELETE, content="Delete"
),
fluent.CommandBarSeparator(),
fluent.CommandBarButton(icon=fluent.FluentIcons.SHARE, content="Share"),
],
secondary_items=[
fluent.CommandBarButton(
icon=fluent.FluentIcons.SETTINGS, content="Settings"
),
],
)

Inherits: LayoutControl
Properties
alignment- How the commands are placed along the bar.card- Whether the bar is shown on a card: a rounded background with a border.compact- Whether the bar shows only the icons of commands that have one.overflow_behavior- What happens whenprimary_itemsdon't fit in the bar.primary_items- The commands shown in the bar:CommandBarButtonandCommandBarSeparatorcontrols.secondary_items- The commands shown in the "More" menu, which opens from a "..." button at the end of the bar.
Example
Fluent CommandBar
import flet_fluent_ui as fluent
import flet as ft
def main(page: ft.Page):
page.title = "Fluent CommandBar"
def handle_click(e: ft.Event[fluent.CommandBarButton]):
status.value = f"{e.control.content} clicked"
status = ft.Text("Pick a command")
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
fluent.CommandBar(
card=True,
primary_items=[
fluent.CommandBarButton(
icon=fluent.FluentIcons.ARROW_REPLY,
content="Reply",
on_click=handle_click,
),
fluent.CommandBarButton(
icon=fluent.FluentIcons.ARROW_FORWARD,
content="Forward",
on_click=handle_click,
),
fluent.CommandBarSeparator(),
fluent.CommandBarButton(
icon=fluent.FluentIcons.ARCHIVE,
content="Archive",
on_click=handle_click,
),
fluent.CommandBarButton(
icon=fluent.FluentIcons.DELETE,
content="Delete",
on_click=handle_click,
),
],
secondary_items=[
fluent.CommandBarButton(
icon=fluent.FluentIcons.FLAG,
content="Flag",
on_click=handle_click,
),
fluent.CommandBarButton(
icon=fluent.FluentIcons.MAIL_READ,
content="Mark as read",
on_click=handle_click,
),
],
),
status,
],
)
)
)
if __name__ == "__main__":
ft.run(main)

Properties
alignmentclass-attributeinstance-attribute
alignment: MainAxisAlignment = MainAxisAlignment.STARTHow the commands are placed along the bar.
cardclass-attributeinstance-attribute
card: bool = FalseWhether the bar is shown on a card: a rounded background with a border.
compactclass-attributeinstance-attribute
compact: bool = FalseWhether the bar shows only the icons of commands that have one.
overflow_behaviorclass-attributeinstance-attribute
overflow_behavior: CommandBarOverflowBehavior = (
CommandBarOverflowBehavior.DYNAMIC_OVERFLOW
)What happens when primary_items don't fit in the bar.
primary_itemsclass-attributeinstance-attribute
primary_items: list[Control] = field(
default_factory=list
)The commands shown in the bar: CommandBarButton
and CommandBarSeparator controls.
Other controls, such as a search box, are shown as they are.