LavaUI docs GitHub

struct StackStyle

Swift

struct StackStyle

Layout settings shared by HStack and VStack.

Sources/LavaUI/Stack.swift:14

Constructors

init(flexGrow: Float = 0, width: Dimension = .auto, height: Dimension = .auto, padding: Float = 0, alignment: StackAlignment = .stretch, spacing: Float? = nil, wraps: Bool = false)

Creates a style. Every parameter matches the property of the same name.

Sources/LavaUI/Stack.swift:35

Properties

var alignment: StackAlignment

How children are placed across the stack.

Sources/LavaUI/Stack.swift:28

var flexGrow: Float

Share of the parent's leftover main-axis space the stack takes.

Sources/LavaUI/Stack.swift:16

var height: Dimension

Height of the stack. .auto sizes it to its children.

Sources/LavaUI/Stack.swift:24

var padding: Float

Space between the stack's edge and its children, on every side, in points.

Sources/LavaUI/Stack.swift:26

var spacing: Float?

Distance between adjacent children. nil uses the theme default.

Sources/LavaUI/Stack.swift:30

var width: Dimension

Width of the stack. .auto sizes it to its children.

A VStack given a .point or .percent width is painted with the theme's panel colour, so it reads as a sidebar. Use .frame(width:) instead when that is not wanted.

Sources/LavaUI/Stack.swift:22

var wraps: Bool

Continue children onto additional flex lines when the main axis fills.

Sources/LavaUI/Stack.swift:32