Object Hierarchy:

Object hierarchy for MenuButton


[ CCode ( type_id = "gtk_menu_button_get_type ()" ) ]
public class MenuButton : Widget, Accessible, Buildable, ConstraintTarget

The MenuButton widget is used to display a popup when clicked on.

This popup can be provided either as a Popover or as an abstract MenuModel.

The MenuButton widget can show either an icon (set with the icon_name property) or a label (set with the label property). If neither is explicitly set, a Image is automatically created, using an arrow image oriented according to direction or the generic “open-menu-symbolic” icon if the direction is not set.

The positioning of the popup is determined by the direction property of the menu button.

For menus, the halign and valign properties of the menu are also taken into account. For example, when the direction is gtk_arrow_down and the horizontal alignment is gtk_align_start, the menu will be positioned below the button, with the starting edge (depending on the text direction) of the menu aligned with the starting edge of the button. If there is not enough space below the button, the menu is popped up above the button instead. If the alignment would move part of the menu offscreen, it is “pushed in”.

Direction = Down

  • halign = start


  • halign = center


  • halign = end


Direction = Up

  • halign = start


  • halign = center


  • halign = end


Direction = Left

  • valign = start


  • valign = center


  • valign = end


Direction = Right

  • valign = start


  • valign = center


  • valign = end


CSS nodes

╰── button.toggle
╰── [content]
ton has a single CSS node with name menubutton which contains a toggle button node.


GtkMenuButton uses the BUTTON role.

Namespace: Gtk
Package: gtk4



Creation methods:


Inherited Members:

All known members inherited from class Gtk.Widget