androidx.compose.foundation.layout

FlexBoxConfigSince 1.11Experimental

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

No hand-written docs yet.

Represents a configuration for a FlexBox container.

fun interface FlexBoxConfig

How to get one

Create it

Used by

Parameters that take a FlexBoxConfig.

Functions

configure

fun FlexBoxConfigScope.configure()

Applies the configuration to the given FlexBoxConfigScope. This method is invoked by the layout system during the measurement phase, not during composition.

thenSince 1.12

fun then(other: FlexBoxConfig): FlexBoxConfig

Merges this config with another. Configs further "to the right" will override properties to the left of them, on a per-property basis.

Library docs

Represents a configuration for a FlexBox container.

This configuration is defined via a lambda that operates on a FlexBoxConfigScope. Because this configuration block is executed during the layout phase rather than the composition phase, reading state variables inside the block will only trigger a layout pass, completely avoiding costly recompositions.

Configuration properties are applied sequentially. If a property is configured multiple times within the block, the final call takes precedence.

Reusability and Responsiveness

Configurations can be extracted, saved, and reused across multiple FlexBox containers: