Skip to main content

MenuFlyoutItem

An item of a Fluent menu: in a ContextMenu, a MenuBarItem, a DropDownButton or a SplitButton.

Give it items to make it open a submenu instead of acting on click.

Example:

fluent.MenuFlyoutItem(
"Copy",
leading=fluent.FluentIcons.COPY,
trailing="Ctrl+C",
on_click=copy,
)

Inherits: Control

Properties

Events

  • on_click - Called when this item is clicked.

Properties​

close_on_clickclass-attributeinstance-attribute​

close_on_click: bool = True

Whether clicking this item closes the menu.

contentinstance-attribute​

content: StrOrControl

The label of this item.

itemsclass-attributeinstance-attribute​

items: list[Control] = field(default_factory=list)

The items of a submenu that opens when this item is hovered or clicked: MenuFlyoutItem, ToggleMenuFlyoutItem, RadioMenuFlyoutItem and MenuFlyoutSeparator controls.

leadingclass-attributeinstance-attribute​

leading: IconDataOrControl | None = None

An icon or control shown before content.

When an item of a menu has one, the labels of the other items are indented to line up with it.

selectedclass-attributeinstance-attribute​

selected: bool = False

Whether this item is highlighted as selected.

trailingclass-attributeinstance-attribute​

trailing: StrOrControl | None = None

Text or a control shown at the end of this item, typically a keyboard shortcut such as "Ctrl+C".

Items with items show a chevron instead.

Events​

on_clickclass-attributeinstance-attribute​

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

Called when this item is clicked.