This is where you decide if items go side by side, stacked, centered, spaced, etc.

The 4 Key Settings
1. Direction (Most Important)
This controls how items are placed inside the container.Horizontal (Row)
- Elements go left β right
- Example: buttons next to each other
- Rows
- Inline elements
- Columns side by side
Vertical (Column)
- Elements go top β bottom
- Example: title β text β button
- Forms
- Stacked content
- Most layouts (default)
2. Distribution (Spacing Between Items)
This controls how items are spaced across the container. Common options:- Start β items stick to the beginning
- Center β items stay in the middle
- End β items go to the end
- Space Between β first left, last right, space in between
- Space Around β equal space around items
π Example: If you have 3 buttons:
- Space Between β spread across full width
- Center β grouped in the middle
3. Align Items (Alignment)
This controls alignment on the opposite axis of Direction.If Direction = Row (horizontal):
- Align Items = vertical alignment
- Top
- Center
- Bottom
If Direction = Column (vertical):
- Align Items = horizontal alignment
- Left
- Center
- Right
Important:
- Direction = main axis
- Align Items = cross axis
4. Gap
- Controls space between elements
- Works like automatic spacing
- Gap = 20 β adds equal spacing between all items
Simple Examples
Example 1: Center everything
- Direction: Vertical
- Align Items: Center
- Distribution: Center
Example 2: Buttons in a row
- Direction: Horizontal
- Distribution: Space Between
- Align Items: Center
Example 3: Simple form layout
- Direction: Vertical
- Align Items: Left
- Gap: 10β20
Common Mistakes
β Trying to center elements without changing Directionβ Confusing Align Items with Distribution
β Adding margin instead of using Gap
β Forgetting container controls child elements
Best Practices
- Start with Column for most layouts
- Use Row only when needed
- Use Gap instead of manual spacing
- Keep layouts simple and consistent
Golden Rule:
If something looks βwrongβ, itβs almost always:
If something looks βwrongβ, itβs almost always:
- Wrong Direction
- Wrong Alignment