minetest-flow/doc/padding.md
2025-02-27 17:33:13 +13:00

1.1 KiB

Padding, spacing, and backgrounds

All elements can have a padding value, which will add the specified amount of padding around the element. The "root" element of the form (the one returned by build_func) has a default padding of 0.3, everything else has a default padding of 0.

HBox and VBox have a spacing field which specifies how much spacing there is between elements inside the box. If unspecified, spacing will default to 0.2.

Container elements (HBox and VBox) can optionally have bgimg and bgimg_middle parameters that specify a background for the container. The background will be drawn behind any padding that the container has.

Example:

gui.VBox{
    padding = 0.5,
    spacing = 0.1,

    -- bgimg can be used without bgimg_middle
    bgimg = "air.png",
    bgimg_middle = 2,

    gui.Button{label="Button 1"},
    gui.Button{label="Button 2"},
}

Screenshot

The padding around the VBox is 0.5 and the spacing between the buttons inside it is 0.1.