Widgets

MenuBar

MenuBar

MenuBar control. Build it with the menu_bar helper.

Example

file_menu = submenu_button(
  [
    menu_item_button(
      "Open",
      leading: icon("folder_open"),
      on_click: ->(event) {}
    ),
    menu_item_button(
      "Save",
      leading: icon("save"),
      on_click: ->(event) {}
    )
  ],
  content: text("File")
)

page.add(menu_bar([file_menu]))

Properties

  • clip_behavior — How content overflowing the bounds is clipped.
  • controls — The list of child controls.
  • style — Style overrides for the control.

Common layout and animation properties

  • badge — Badge drawn on the corner of the control.
  • col — Responsive column span (1-12) per breakpoint.
  • data — Arbitrary value you can attach to the control and read back in handlers.
  • disabled — Disables interaction when true.
  • expand — Fills the available space along the parent's main axis when true.
  • expand_loose — Like expand, but only grows up to the child's natural size.
  • key — Stable identity used to preserve state across rebuilds.
  • opacity — Opacity from 0.0 (transparent) to 1.0 (opaque).
  • rtl — Renders right-to-left when true.
  • tooltip — Text shown on hover/long-press.
  • visible — Hides the control when false.

Reference

  • Family: materials
  • Widget type: menubar
  • Helpers: menu_bar, menubar