androidx.compose.material3

HorizontalDivider

Composable function

A divider is a thin line between groups of content, like items in a list. HorizontalDivider fills the width. VerticalDivider fills the height.

A line between items
A line between items
Column(Modifier.width(240.dp)) {
    Text("First", Modifier.padding(12.dp))
    HorizontalDivider()
    Text("Second", Modifier.padding(12.dp))
}

A vertical divider in a Row needs a height. Give the row Modifier.height(IntrinsicSize.Min), so the divider is as tall as the other items.

A vertical line in a row
A vertical line in a row
Row(Modifier.height(IntrinsicSize.Min), verticalAlignment = Alignment.CenterVertically) {
    Text("Left", Modifier.padding(12.dp))
    VerticalDivider()
    Text("Right", Modifier.padding(12.dp))
}

Parameters

@Composable
fun HorizontalDivider(
    modifier: Modifier = Modifier,
    thickness: Dp = DividerDefaults.Thickness,
    color: Color = DividerDefaults.color,
)

modifier: ModifierOptional

Default: Modifier

Changes size, padding, or position. Use padding to indent the line, for example to line up with text in a list.

thickness: DpOptional

Default: DividerDefaults.Thickness

How thick the line is. Default: 1 dp.

color: ColorOptional

Default: DividerDefaults.color

The line color. Default: the theme's outlineVariant.

Divider types