androidx.compose.foundation.layout

Column

Composable function · from org.jetbrains.compose.foundation:foundation-layout:1.12.2

One of the linear layouts. It works like Row. Only the parameters that differ are described here.

The same as Row, turned vertical. Arrangement is now top to bottom, and alignment is start to end.

Column(
    verticalArrangement = Arrangement.spacedBy(4.dp),
    horizontalAlignment = Alignment.CenterHorizontally,
) {
    Text("Title", style = MaterialTheme.typography.titleLarge)
    Text("Subtitle")
}

Parameters

@Composable
fun Column(
    modifier: Modifier = Modifier,
    verticalArrangement: Arrangement.Vertical = Arrangement.Top,
    horizontalAlignment: Alignment.Horizontal = Alignment.Start,
    content: @Composable ColumnScope.() -> Unit,
)

verticalArrangement: Arrangement.VerticalOptional

Default: Arrangement.Top

How children are spread from top to bottom. Arrangement.spacedBy(8.dp) puts 8 dp between them. In a Column this is the main direction.

horizontalAlignment: Alignment.HorizontalOptional

Default: Alignment.Start

How children line up horizontally: Alignment.Start, CenterHorizontally or End.

content: @Composable ColumnScope.() -> UnitRequired

The children. Each composable you call inside is one child, in order.

Same as in Row: modifier.

Linear layouts