Overview
Control how children are aligned within an auto-layout frame. The primary axis runs in the direction of the layout (horizontal or vertical), while the counter axis runs perpendicular to it.Parameters
The ID of the frame to modify
Primary axis alignment (distribution along the layout direction)For horizontal layouts:
MIN- Align leftMAX- Align rightCENTER- Center horizontallySPACE_BETWEEN- Distribute with space between items
MIN- Align topMAX- Align bottomCENTER- Center verticallySPACE_BETWEEN- Distribute with space between items
Counter axis alignment (alignment perpendicular to the layout direction)For horizontal layouts:
MIN- Align topMAX- Align bottomCENTER- Center verticallyBASELINE- Align text baselines
MIN- Align leftMAX- Align rightCENTER- Center horizontallyBASELINE- Align text baselines
Response
Examples
Center-aligned button
Space-between navigation
Left-aligned form fields
Text baseline alignment
Understanding Axes
Horizontal Layout (HORIZONTAL)
- Primary axis: Left to right →
- Counter axis: Top to bottom ↓
Vertical Layout (VERTICAL)
- Primary axis: Top to bottom ↓
- Counter axis: Left to right →
Use Cases
Centered buttons:primaryAxisAlignItems: CENTER, counterAxisAlignItems: CENTER
Navigation bars: primaryAxisAlignItems: SPACE_BETWEEN to distribute items evenly
Form layouts: primaryAxisAlignItems: MIN to stack fields from top, counterAxisAlignItems: MIN to left-align
Card headers: counterAxisAlignItems: CENTER to vertically center icon and title
Text rows: counterAxisAlignItems: BASELINE to align text properly
Design Tips
SPACE_BETWEENis perfect for distributing navigation items or card footers- Use
CENTER/CENTERfor buttons and call-to-action elements BASELINEalignment ensures text looks aligned even with different font sizes- Combine with
set_layout_sizingto control how children fill available space
Related Tools
- set_layout_mode - Set the layout direction
- set_item_spacing - Control spacing between children
- set_layout_sizing - Control how frames resize