Skip to main content
Spacer(props?: { minLength: number }): Component;
props
object
Configuration options for the spacer.

Support

Usage

Push items apart in an HStack

HStack([
    Text("Leading"),
    Spacer(),
    Text("Trailing")
])

Push content to the top

VStack([
    Text("Top"),
    Spacer()
])
    .frame({ maxHeight: ".infinity" })

With minimum length

HStack([
    Text("Left"),
    Spacer({ minLength: 24 }),
    Text("Right")
])

Notes

  • In a VStack, Spacer expands vertically. In an HStack, it expands horizontally.
  • Multiple Spacers in the same stack share the available space equally.