Class VStack


public class VStack extends Stack<VStack>
A vertical stack layout container that arranges children in a column.

VStack uses CSS Flexbox with flex-direction: column to lay out child elements vertically from top to bottom. It provides convenient methods for controlling spacing, alignment, and distribution of children.

Features:

Usage:


 // Simple form layout
 VStack form = new VStack();
 form.setGap(16);
 form.addElement(new TextInput().setPlaceholder("Username"));
 form.addElement(new PasswordInput().setPlaceholder("Password"));
 form.addElement(new Button("Login"));

 // Card with header, content, and footer
 VStack card = new VStack();
 card.setGap(12);
 card.addElement(header);
 card.addElement(new Spacer());  // Push footer to bottom
 card.addElement(footer);

 // Centered content
 VStack centered = new VStack().center().setGap(8);
 
Since:
2025
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • VStack

      public VStack()
      Constructs an empty vertical stack.
    • VStack

      public VStack(int gap)
      Constructs a vertical stack with the specified gap between children.
      Parameters:
      gap - the gap in pixels between child elements
    • VStack

      public VStack(String gap)
      Constructs a vertical stack with the specified gap between children.
      Parameters:
      gap - the gap value (e.g., "1rem", "16px")