androidx.compose.material3
CenterAlignedTopAppBar
Composable function
One of the top app bar types. It works like TopAppBar. Only the parameters that differ are described here.
The title is in the middle. Use it on the main screen of an app.

// 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)
CenterAlignedTopAppBar(
title = { Text("Photos") },
navigationIcon = { IconButton(onClick = {}) { Icon(Icons.Filled.Menu, "Menu") } },
actions = { IconButton(onClick = {}) { Icon(Icons.Filled.Person, "Account") } },
modifier = barOutline,
)
Parameters
@Composable
fun CenterAlignedTopAppBar(
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
navigationIcon: @Composable () -> Unit = {},
actions: @Composable RowScope.() -> Unit = {},
expandedHeight: Dp = TopAppBarDefaults.TopAppBarExpandedHeight,
windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
colors: TopAppBarColors = TopAppBarDefaults.topAppBarColors(),
scrollBehavior: TopAppBarScrollBehavior? = null,
contentPadding: PaddingValues = TopAppBarDefaults.ContentPadding,
)
Same as in TopAppBar: title, modifier, navigationIcon, actions, expandedHeight, windowInsets, colors, scrollBehavior, contentPadding.
Top app bar types
TopAppBarCenterAlignedTopAppBarMediumTopAppBarLargeTopAppBarMediumFlexibleTopAppBarLargeFlexibleTopAppBarTwoRowsTopAppBar
See also
TopAppBarDefaults: default values and helper functions forCenterAlignedTopAppBar.