State of Compose 2023 results are in! Click here to learn more

← Back to Compose UI

Layout

Component
in
Compose UI
. Since 0.1.0-dev15

Overview

Code Examples

Video

Layout is the main core component for layout. It can be used to measure and position zero or more layout children.

The measurement, layout and intrinsic measurement behaviours of this layout will be defined by the measurePolicy instance. See MeasurePolicy for more details.

For a composable able to define its content according to the incoming constraints, see androidx.compose.foundation.layout.BoxWithConstraints.

Overloads

Layout

@Suppress("ComposableLambdaParameterPosition")
@UiComposable
@Composable
inline fun Layout(
    content: @Composable @UiComposable () -> Unit,
    modifier: Modifier = Modifier,
    measurePolicy: MeasurePolicy
)

Parameters

NameDescription
contentThe children composable to be laid out.
modifierModifiers to be applied to the layout.
measurePolicyThe policy defining the measurement and positioning of the layout. @see Layout @see MeasurePolicy @see androidx.compose.foundation.layout.BoxWithConstraint

Layout

@Suppress("NOTHING_TO_INLINE")
@Composable
@UiComposable
inline fun Layout(
    modifier: Modifier = Modifier,
    measurePolicy: MeasurePolicy
)

Parameters

NameDescription
modifierModifiers to be applied to the layout.
measurePolicyThe policy defining the measurement and positioning of the layout. @see Layout @see MeasurePolicy @see androidx.compose.foundation.layout.BoxWithConstraint

Layout

@Suppress("ComposableLambdaParameterPosition", "NOTHING_TO_INLINE")
@UiComposable
@Composable
inline fun Layout(
    contents: List<@Composable @UiComposable () -> Unit>,
    modifier: Modifier = Modifier,
    measurePolicy: MultiContentMeasurePolicy
)

Parameters

NameDescription
contentsThe list of children composable contents to be laid out.
modifierModifiers to be applied to the layout.
measurePolicyThe policy defining the measurement and positioning of the layout. @see Layout for a simpler use case when you have only one content lambda