androidx.compose.material3
TwoRowsTopAppBarSince 1.10Experimental
Composable function
One of the top app bar types. It works like TopAppBar. Only the parameters that differ are described here.
The bar the medium and large bars are built on. You set both heights, and the title gets expanded so it can change.

// Top app bars have the same color as the page. The border only shows where the bar ends.
val barOutline @Composable get() = Modifier.width(360.dp).border(1.dp, MaterialTheme.colorScheme.outlineVariant)
TwoRowsTopAppBar(
// expanded is true while the bar shows both rows.
title = { expanded -> Text(if (expanded) "All photos" else "Photos") },
navigationIcon = { IconButton(onClick = {}) { Icon(Icons.AutoMirrored.Filled.ArrowBack, "Back") } },
collapsedHeight = 64.dp,
expandedHeight = 120.dp,
modifier = barOutline,
)
ParametersExperimental
@Composable
fun TwoRowsTopAppBar(
title: @Composable (expanded: Boolean) -> Unit,
modifier: Modifier = Modifier,
subtitle: (@Composable (expanded: Boolean) -> Unit)? = null,
navigationIcon: @Composable () -> Unit = {},
actions: @Composable RowScope.() -> Unit = {},
titleHorizontalAlignment: Alignment.Horizontal = Alignment.Start,
collapsedHeight: Dp = Dp.Unspecified,
expandedHeight: Dp = Dp.Unspecified,
windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
colors: TopAppBarColors = TopAppBarDefaults.topAppBarColors(),
scrollBehavior: TopAppBarScrollBehavior? = null,
)
title: @Composable (expanded: Boolean) -> UnitRequired
title: @Composable (expanded: Boolean) -> UnitRequiredThe title of the screen. Usually one Text. Long titles are cut off with "…".
subtitle: (@Composable (expanded: Boolean) -> Unit)?Optional
subtitle: (@Composable (expanded: Boolean) -> Unit)?OptionalDefault: null
A second, smaller line under the title.

TopAppBar(
title = { Text("Trip to Lisbon") },
subtitle = { Text("3 nights") },
navigationIcon = {
IconButton(onClick = {}) { Icon(Icons.Filled.Menu, "Menu") }
},
modifier = Modifier.width(360.dp),
)
collapsedHeight: DpOptional
collapsedHeight: DpOptionalDefault: Dp.Unspecified
The height of a medium or large bar after it shrinks.
Defaults that differ from TopAppBar:
Same as in TopAppBar: modifier, navigationIcon, actions, titleHorizontalAlignment, expandedHeight, windowInsets, colors, scrollBehavior.
Top app bar types
TopAppBarCenterAlignedTopAppBarMediumTopAppBarLargeTopAppBarMediumFlexibleTopAppBarLargeFlexibleTopAppBarTwoRowsTopAppBar
See also
TopAppBarDefaults: default values and helper functions forTwoRowsTopAppBar.