Skip to main content

Variable: Box

const Box: "Box"

Defined in: react/src/generated/jsx.ts:11117

Arranges child widgets into a single row or column.

Whether it is a row or column depends on the value of its [property@Gtk.Orientable:orientation] property. Within the other dimension, all children are allocated the same size. The [property@Gtk.Widget:halign] and [property@Gtk.Widget:valign] properties can be used on the children to influence their allocation.

Use repeated calls to [method@Gtk.Box.append] to pack widgets into a GtkBox from start to end. Use [method@Gtk.Box.remove] to remove widgets from the GtkBox. [method@Gtk.Box.insert_child_after] can be used to add a child at a particular position.

Use [method@Gtk.Box.set_homogeneous] to specify whether or not all children of the GtkBox are forced to get the same amount of space.

Use [method@Gtk.Box.set_spacing] to determine how much space will be minimally placed between all children in the GtkBox. Note that spacing is added between the children.

Use [method@Gtk.Box.reorder_child_after] to move a child to a different place in the box.

CSS nodes

GtkBox uses a single CSS node with name box.

Accessibility

Until GTK 4.10, GtkBox used the [enum@Gtk.AccessibleRole.group] role.

Starting from GTK 4.12, GtkBox uses the [enum@Gtk.AccessibleRole.generic] role.