AdwButtonContent

A helper widget for creating buttons.

<picture> <source srcset="button-content-dark.png" media="(prefers-color-scheme: dark)"> <img src="button-content.png" alt="button-content"> </picture>

adw.button_content.ButtonContent is a box-like widget with an icon and a label.

It's intended to be used as a direct child of gtk.button.Button, gtk.menu_button.MenuButton or class@SplitButton, when they need to have both an icon and a label, as follows:

<object class="GtkButton">
  <property name="child">
    <object class="AdwButtonContent">
      <property name="icon-name">document-open-symbolic</property>
      <property name="label" translatable="yes">_Open</property>
      <property name="use-underline">True</property>
    </object>
  </property>
</object>

adw.button_content.ButtonContent handles style classes and connecting the mnemonic to the button automatically.

CSS nodes

buttoncontent
╰── box
    ├── image
    ╰── label

adw.button_content.ButtonContent's CSS node is called buttoncontent. It contains a box subnode that serves as a container for the image and label nodes.

When inside a gtk.button.Button or adw.split_button.SplitButton, the button will receive the .image-text-button style class. When inside a gtk.menu_button.MenuButton, the internal gtk.button.Button will receive it instead.

Accessibility

adw.button_content.ButtonContent uses the gtk.types.AccessibleRole.Group role.

struct AdwButtonContent