Skip to content

Space

A space is an empty, fixed-size gap between two views. It applies its size in both directions, so it works in a VStack as well as in an HStack. For equal spacing between all children prefer the Gap of the stack; use a space where one gap differs, and a Spacer for flexible space.

Space

return HStack(
	Text("A").BackgroundColor("#C9E7F8").Padding(Padding{}.All(L16)),
	Space(L8),
	Text("B").BackgroundColor("#C9E7F8").Padding(Padding{}.All(L16)),
	Space(L48),
	Text("C").BackgroundColor("#C9E7F8").Padding(Padding{}.All(L16)),
).BackgroundColor(ColorCardBody).
	Padding(Padding{}.All(L8))

Constructors

ConstructorDescription
Space(size Length) TSpaceCreates a fixed-size spacer with the given length.

Methods

MethodDescription
Size(size Length) TSpaceChanges the size of the space.

Related