---
title: "Flexbox Layout Behavior in Jetpack Compose"
description: "Most CSS flexbox layout concepts map directly onto Jetpack Compose primitives."
url: "https://swe.quest/articles/flexbox-layout-behavior-in-jetpack-compose-2c26f3047764dfd2"
canonical: "https://engineering.zalando.com/posts/2021/03/flexbox-layout-behavior-in-jetpack-compose.html"
source: "Zalando Engineering"
published: "2021-03-15"
difficulty: "medium"
kind: "How-to"
reading_minutes: 6
tags: ["mobile","frontend","css"]
---

# Flexbox Layout Behavior in Jetpack Compose

A post on [Zalando Engineering](https://swe.quest/sources/zalando.md), published 2021-03-15, 6 min read, How-to. Original: [https://engineering.zalando.com/posts/2021/03/flexbox-layout-behavior-in-jetpack-compose.html](https://engineering.zalando.com/posts/2021/03/flexbox-layout-behavior-in-jetpack-compose.html)

## Summary

Most CSS flexbox layout concepts map directly onto Jetpack Compose primitives. Row and Column cover flex direction, the weight() modifier covers flex grow, and Arrangement and Alignment parameters cover justify-content and align-items/align-self. Stretch maps to fillMax\* modifiers, and Box with align() handles absolute positioning. Gaps remain: flex wrap relied on the now-deprecated FlowRow/FlowColumn, Compose has no flex shrink (IntrinsicSize.Min can sometimes stand in), and there is no cross-axis space-between, so custom Layout or ConstraintLayout is needed for full flexbox behavior. Zalando is evaluating Compose as a successor to Litho for its backend-driven screens.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Mobile](https://swe.quest/tags/mobile.md) (Web & mobile)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [CSS](https://swe.quest/tags/css.md) (Web & mobile)

## Prerequisites

- CSS flexbox ([easy posts on CSS](https://swe.quest/tags/css.md?difficulty=easy))
- Android development basics ([easy posts on Mobile](https://swe.quest/tags/mobile.md?difficulty=easy))
- Kotlin ([easy posts on Java & JVM](https://swe.quest/tags/jvm.md?difficulty=easy))

## Keywords

Jetpack Compose, Flexbox, Litho, Yoga, ConstraintLayout, FlowRow, Kotlin

## Related posts

- [Adopting Jetpack Compose for Etsy’s Android App](https://swe.quest/articles/adopting-jetpack-compose-for-etsy-s-android-app-07407ea696750e78.md): Etsy Code as Craft · 2025-01-28 · Medium · 6 min read · Mobile, Refactoring & migrations, Design systems, Java & JVM, Frontend
  Etsy adopted Jetpack Compose as its preferred Android UI toolkit through a staged rollout.
- [Introducing CSS Grid Lanes](https://swe.quest/articles/introducing-css-grid-lanes-2d3c264610a9740d.md): WebKit · 2025-12-19 · Medium · 8 min read · CSS, Browsers, Frontend, Accessibility
  CSS Grid Lanes (\`display: grid-lanes\`) brings native masonry layouts to the web, available in Safari Technology Preview 234.
- [CSS Grid: A helpful mental model and the power of grid lines](https://swe.quest/articles/css-grid-a-helpful-mental-model-and-the-power-of-grid-lines-4d5050e2d975310a.md): WebKit · 2025-10-10 · Medium · 9 min read · CSS, Frontend
  CSS Grid becomes easier to reason about when a layout starts from the container, treated like a spreadsheet whose columns and rows are defined before content is placed.
- [Item Flow, Part 1: A new unified concept for layout](https://swe.quest/articles/item-flow-part-1-a-new-unified-concept-for-layout-1d0cd96bcbdcf802.md): WebKit · 2025-03-28 · Medium · 12 min read · CSS, Frontend, Browsers
  Item Flow was a proposed unified CSS property system (shorthand \`item-flow\` with longhands \`item-direction\`, \`item-wrap\`, \`item-pack\`, \`item-slack\`) that would replace \`flex-flow\` and \`grid-auto-flow\` across Flexbox, Grid and masonry layouts.
- [Subgrid: how to line up elements to your heart’s content](https://swe.quest/articles/subgrid-how-to-line-up-elements-to-your-heart-s-content-a1a2b0f9110769af.md): WebKit · 2025-09-12 · Medium · 4 min read · CSS, Frontend
  CSS subgrid lets nested grid items adopt the row or column tracks defined on a parent grid, so content inside sibling cards stays aligned even when one card has longer text.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
