Skip to main content
These three components produce no content of their own — they exist to shape the space around other components. Empty renders nothing and takes no space, useful as the else-branch of a conditional. Spacer expands to fill available space along the major axis of its parent stack. Divider draws a thin separator line, adapting its orientation to the parent stack.

Empty

An empty component that renders nothing.
Empty takes no parameters. It produces a component that renders nothing and occupies no space. Conditional rendering Use Empty as the else-branch when conditionally showing content:
Placeholder in layouts

Spacer

A flexible space that expands along the major axis of its parent stack.
props
object
Configuration options for the spacer.
Push items apart in an HStack
Push content to the top
With minimum length
In a VStack, Spacer expands vertically. In an HStack, it expands horizontally. Multiple Spacers in the same stack share the available space equally.

Divider

A thin line separator that adapts its orientation to the parent stack.
Divider takes no parameters. It renders a horizontal line in a VStack and a vertical line in an HStack. In a VStack
In an HStack
Separating list items

See also

  • VStack — vertical stack that hosts spacers and dividers
  • HStack — horizontal stack that hosts spacers and dividers
  • Group — group components without adding layout
  • ForEach — iterate over data to produce children