androidx.compose.foundation.layout

FlexBoxConfigScopeSince 1.11Experimental

Sealed interface · from org.jetbrains.compose.foundation:foundation-layout:1.12.2

No hand-written docs yet.

Receiver scope for configuring FlexBox container properties.

sealed interface FlexBoxConfigScope : Density

Is a

Properties

constraints

val constraints: Constraints

The layout constraints passed to this FlexBox from its parent.

Functions

direction

fun direction(value: FlexDirection)

Sets the direction of the main axis along which children are laid out.

wrap

fun wrap(value: FlexWrap)

Sets whether children are forced onto a single line or can wrap onto multiple lines. - FlexWrap.NoWrap: All items stay on one line. Items may visually overflow on main axis if they cannot shrink enough. - FlexWrap.Wrap: Items wrap to new lines toward the cross-end edge. - FlexWrap.WrapReverse: Items wrap to new lines toward the cross-start edge.

justifyContent

fun justifyContent(value: FlexJustifyContent)

Sets how children are distributed along the main axis.

alignItems

fun alignItems(value: FlexAlignItems)

Sets the default alignment for children along the cross axis within each line.

fun alignItems(alignmentLine: AlignmentLine)

Aligns all items to a specific baseline.

fun alignItems(alignmentLineBlock: (Measured) -> Int)

Aligns all items to a custom baseline computed from each measured item.

alignContent

fun alignContent(value: FlexAlignContent)

Sets how multiple lines are distributed along the cross axis.

rowGap

fun rowGap(value: Dp)

Sets the vertical spacing between items or lines.

columnGap

fun columnGap(value: Dp)

Sets the horizontal spacing between items or columns.

gap

fun gap(all: Dp)

Sets both rowGap and columnGap to the same value.

fun gap(row: Dp, column: Dp)

Sets rowGap and columnGap to different values.

Library docs

Receiver scope for configuring FlexBox container properties.

This scope is provided by FlexBoxConfig. All configuration functions are called during the layout/measure phase, not during composition. Changes to state-backed values read within this scope will trigger a relayout, entirely skipping recomposition.