Jetpack Compose provides several layout containers to help you structure and
arrange your UI components. While fundamental layout composables like Row and
Column handle straightforward arrangements, many apps require more responsive
and adaptive container solutions as screen sizes change and user data grows.
Layout containers include the following:
- Lazy lists and lazy grids: Components such as
LazyColumn,LazyRow, andLazyVerticalGridthat efficiently display large or dynamically-sized data sets by only composing and laying out items currently visible in the viewport. - Pager: Containers like
HorizontalPagerandVerticalPagerthat let users swipe or scroll between pages of content. - Flow layouts: Responsive one-dimensional containers
(
FlowRowandFlowColumn) that automatically wrap overflowing items onto the next row or column when space runs out. - Grid: A flexible, two-dimensional structure that displays items in multi-column or multi-row layouts that adapt to the container size.
- FlexBox: A CSS Flexbox-inspired, adaptive container that provides granular control over how items wrap, grow, shrink, and align along main and cross axes to fill available space.
Choose the correct layout container
When building layouts in Compose, choosing between basic and more advanced layout containers depends on your design, whether items must wrap when space is constrained, and how items dynamically resize.
The following table summarizes the capabilities for each of the Compose 1D layout containers:
Container |
Wraps items to new lines |
Per-item grow |
Per-item shrink |
Per-item starting size |
Items grow to fill available space on multiple lines |
Reorder items |
Lazy loading |
Best for: |
Row / Column |
❌ |
✅ (via |
❌ |
❌ |
❌ |
❌ |
❌ |
|
FlowRow / FlowColumn |
✅ |
Limited |
❌ |
❌ |
Partial |
❌ |
❌ |
|
LazyRow / LazyColumn |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
✅ |
|
FlexBox |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
❌ |
|
The following table summarizes the capabilities for Grid and other similar
composables:
Container |
Strict 2D alignment |
Item spanning (columns) |
Item spanning (rows) |
Lazy loading |
Best for: |
Grid |
✅ |
✅ (via |
✅ |
❌ |
|
LazyVerticalGrid |
✅ |
✅ (via |
❌ |
✅ |
|
LazyStaggeredGrid |
❌ (1D only) |
Partial (full span only) |
❌ |
✅ |
|
LazyHorizontalGrid |
✅ |
❌ |
✅ |
✅ |
|
Combining rows and columns |
❌ |
❌ |
❌ |
❌ |
|