Object Hierarchy:

Gtk.Button Gtk.Button Gtk.Button Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Button GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Gtk.Accessible Gtk.Accessible Gtk.Accessible->Gtk.Button Gtk.Accessible->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.Button Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget Gtk.ConstraintTarget Gtk.ConstraintTarget->Gtk.Button Gtk.ConstraintTarget->Gtk.Widget Gtk.Actionable Gtk.Actionable Gtk.Actionable->Gtk.Button


[ CCode ( type_id = "gtk_button_get_type ()" ) ]
public class Button : Widget, Accessible, Actionable, Buildable, ConstraintTarget

The `GtkButton` widget is generally used to trigger a callback function that is called when the button is pressed.

![An example GtkButton](button.png)

The `GtkButton` widget can hold any valid child widget. That is, it can hold almost any other standard `GtkWidget`. The most commonly used child is the `GtkLabel`.

CSS nodes

`GtkButton` has a single CSS node with name button. The node will get the style classes .image-button or .text-button, if the content is just an image or label, respectively. It may also receive the .flat style class. When activating a button via the keyboard, the button will temporarily gain the .keyboard-activating style class.

Other style classes that are commonly used with `GtkButton` include .suggested-action and .destructive-action. In special cases, buttons can be made round by adding the .circular style class.

Button-like widgets like [class@Gtk.ToggleButton], [class@Gtk.MenuButton], [class@Gtk.VolumeButton], [class@Gtk.LockButton], [ class@Gtk.ColorButton] or [class@Gtk.FontButton] use style classes such as .toggle, .popup, .scale, .lock, .color on the button node to differentiate themselves from a plain `GtkButton`.


`GtkButton` uses the gtk_accessible_role_button role.

All known sub-classes:

Namespace: Gtk
Package: gtk4



Creation methods:



Inherited Members:

All known members inherited from class Gtk.Widget