Skip to main content

CommandBarButton

A command in a CommandBar: an icon with a label in the bar, or a menu item in its "More" menu.

Example:

fluent.CommandBarButton(
icon=fluent.FluentIcons.ADD, content="New", on_click=new_item
)

Inherits: Control

Properties

  • content - The label of this command.
  • icon - The icon of this command.
  • tooltip - Text shown when the mouse pointer rests on this command.

Events

  • on_click - Called when this command is clicked.

Properties​

contentclass-attributeinstance-attribute​

content: StrOrControl | None = None

The label of this command.

A compact bar shows it only when there is no icon.

iconclass-attributeinstance-attribute​

icon: IconDataOrControl | None = None

The icon of this command.

tooltipclass-attributeinstance-attribute​

tooltip: str | None = None

Text shown when the mouse pointer rests on this command.

In the "More" menu, it is also shown at the end of the item.

Events​

on_clickclass-attributeinstance-attribute​

on_click: (
    ControlEventHandler[CommandBarButton] | None
) = None

Called when this command is clicked.