by @alexstyl
✉️ Leave your feedback

← Back to Compose Multiplatform


Compose Multiplatform
. Since 1.3.0-beta01



Community Notes


<a href="" class="external" target="_blank">Material Design center-aligned small top app bar</a>.

Top app bars display information and actions at the top of a screen.

This small top app bar has a header title that is horizontally aligned to the center.

!Center-aligned top app bar image(

This CenterAlignedTopAppBar has slots for a title, navigation icon, and actions.

A center aligned top app bar that uses a scrollBehavior to customize its nested scrolling behavior when working in conjunction with a scrolling content looks like:



fun CenterAlignedTopAppBar(
    title: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    navigationIcon: @Composable () -> Unit = {},
    actions: @Composable RowScope.() -> Unit = {},
    windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
    colors: TopAppBarColors = TopAppBarDefaults.centerAlignedTopAppBarColors(),
    scrollBehavior: TopAppBarScrollBehavior? = null


titlethe title to be displayed in the top app bar
modifierthe Modifier to be applied to this top app bar
navigationIconthe navigation icon displayed at the start of the top app bar. This should typically be an IconButton or IconToggleButton.
actionsthe actions displayed at the end of the top app bar. This should typically be IconButtons. The default layout here is a Row, so icons inside will be placed horizontally.
windowInsetsa window insets that app bar will respect.
colorsTopAppBarColors that will be used to resolve the colors used for this top app bar in different states. See TopAppBarDefaults.centerAlignedTopAppBarColors.
scrollBehaviora TopAppBarScrollBehavior which holds various offset values that will be applied by this top app bar to set up its height and colors. A scroll behavior is designed to work in conjunction with a scrolled content to change the top app bar appearance as the content scrolls. See TopAppBarScrollBehavior.nestedScrollConnection
Previous ComponentCard
Next ComponentCheckbox