# Layout Systems: Flexbox, Rows, Columns & Stacks

> Position elements with the layout model of your stack: Flexbox in React Native, Row/Column in Flutter and Compose, stacks in SwiftUI. Free notes, key concepts,...

Canonical: https://www.internhack.in/roadmaps/tracks/mobile/layout-systems
Last updated: 2026-11-28

Position elements with the layout model of your stack: Flexbox in React Native, Row/Column in Flutter and Compose, stacks in SwiftUI.

Beginner · about 6 hours · difficulty 2/5

Learn first: [Components, Props & Styling](https://www.internhack.in/roadmaps/tracks/mobile/components-and-styling)

Mobile layout systems are all variations of the same few ideas: place children in a row or column, decide how extra space is shared, and align them on the cross axis.

### React Native: Flexbox

- Default `flexDirection` is `column` (unlike the web).
- `justifyContent` distributes along the main axis, `alignItems` along the cross axis.
- `flex: 1` makes a child fill the remaining space; `gap` adds spacing between children.
- Use `position: "absolute"` sparingly for overlays and badges.

### Flutter and Compose

- `Row`, `Column` and `Stack` (Flutter) or `Row`, `Column`, `Box` (Compose).
- `Expanded`/`Flexible` (Flutter) or `Modifier.weight()` (Compose) share space.
- Flutter's rule: \*constraints go down, sizes go up, parent sets position\*. Most overflow errors come from unbounded constraints.

### SwiftUI

`HStack`, `VStack`, `ZStack`, `Spacer` and `.frame()`. Views size themselves from content; modifiers wrap views, so modifier order changes the result.

### Pitfalls

- Nesting scroll views in the same direction.
- Fixed widths and heights that break on small phones or large fonts.

**Good enough to move on:** you can recreate a profile header (avatar, name, stats row, follow button) from a screenshot without fixed pixel positions.

## Key concepts

- **Main axis and cross axis**
- **Flexbox in React Native**
- **Row, Column and Stack widgets**: Flutter and Compose
- **HStack, VStack and ZStack**: SwiftUI
- **Sharing space: flex, Expanded, weight**
- **Absolute positioning and overlays**
- **Flutter constraints model**: Essential if you chose Flutter

## Mini project

Clone the layout of a music player screen (album art, title, progress bar, controls row) that looks right on both a small and a large phone.

## Check yourself

What does flex: 1 do on a child inside a column, and what happens if its parent has no defined height?

## Free resources

- [React Native: Layout with Flexbox](https://reactnative.dev/docs/flexbox) (React Native)
- [Flutter: Layouts](https://docs.flutter.dev/ui/layout) (Flutter)
- [Compose layout basics](https://developer.android.com/develop/ui/compose/layouts/basics) (Android Developers)

Previous: [Components, Props & Styling](https://www.internhack.in/roadmaps/tracks/mobile/components-and-styling) · Next: [Responsive & Adaptive Screens](https://www.internhack.in/roadmaps/tracks/mobile/responsive-adaptive)

## More in Screens, Layouts & Responsive UI

- [Components, Props & Styling](https://www.internhack.in/roadmaps/tracks/mobile/components-and-styling)
- [Layout Systems: Flexbox, Rows, Columns & Stacks](https://www.internhack.in/roadmaps/tracks/mobile/layout-systems)
- [Responsive & Adaptive Screens](https://www.internhack.in/roadmaps/tracks/mobile/responsive-adaptive)
- [Lists, Scrolling & User Input](https://www.internhack.in/roadmaps/tracks/mobile/lists-and-forms)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Mobile App Developer Roadmap](https://www.internhack.in/roadmaps/tracks/mobile)
