State of Compose 2023 results are in! Click here to learn more

← Back to Material Compose

BottomAppBar

Component
in
Material
. Since 0.1.0-dev15

Overview

Code Examples

<a href="https://material.io/components/app-bars-bottom" class="external" target="_blank">Material Design bottom app bar</a>.

A bottom app bar displays navigation and key actions at the bottom of screens.

!App bars: bottom image(https://developer.android.com/images/reference/androidx/compose/material/app-bars-bottom.png)

This particular overload provides ability to specify WindowInsets. Recommended value can be found in AppBarDefaults.bottomAppBarWindowInsets.

It can also optionally display a FloatingActionButton, which is either overlaid on top of the BottomAppBar, or inset, carving a cutout in the BottomAppBar.

See BottomAppBar anatomy(https://material.io/components/app-bars-bottom/#anatomy) for the recommended content depending on the FloatingActionButton position.

Note that when you pass a non-null cutoutShape this makes the AppBar shape concave. The shadows for such shapes will not be drawn on Android versions less than 10.

The LocalContentAlpha inside a BottomAppBar is ContentAlpha.medium - this is the default for trailing and overflow icons. It is recommended that any leading icons at the start of the BottomAppBar, such as a menu icon, use ContentAlpha.high instead. This is demonstrated in the sample below.

Also see BottomNavigation.

Overloads

BottomAppBar

@Composable
fun BottomAppBar(
    windowInsets: WindowInsets,
    modifier: Modifier = Modifier,
    backgroundColor: Color = MaterialTheme.colors.primarySurface,
    contentColor: Color = contentColorFor(backgroundColor),
    cutoutShape: Shape? = null,
    elevation: Dp = AppBarDefaults.BottomAppBarElevation,
    contentPadding: PaddingValues = AppBarDefaults.ContentPadding,
    content: @Composable RowScope.() -> Unit
)

Parameters

NameDescription
windowInsetsa window insets that app bar will respect.
modifierThe Modifier to be applied to this BottomAppBar
backgroundColorThe background color for the BottomAppBar. Use Color.Transparent to have no color.
contentColorThe preferred content color provided by this BottomAppBar to its children. Defaults to either the matching content color for backgroundColor, or if backgroundColor is not a color from the theme, this will keep the same value set above this BottomAppBar.
cutoutShapethe shape of the cutout that will be added to the BottomAppBar - this should typically be the same shape used inside the FloatingActionButton, when BottomAppBar and FloatingActionButton are being used together in Scaffold. This shape will be drawn with an offset around all sides. If null, where will be no cutout.
elevationthe elevation of this BottomAppBar.
contentPaddingthe padding applied to the content of this BottomAppBar
contentthe content of this BottomAppBar. The default layout here is a Row, so content inside will be placed horizontally

BottomAppBar

@Composable
fun BottomAppBar(
    modifier: Modifier = Modifier,
    backgroundColor: Color = MaterialTheme.colors.primarySurface,
    contentColor: Color = contentColorFor(backgroundColor),
    cutoutShape: Shape? = null,
    elevation: Dp = AppBarDefaults.BottomAppBarElevation,
    contentPadding: PaddingValues = AppBarDefaults.ContentPadding,
    content: @Composable RowScope.() -> Unit
)

Parameters

NameDescription
modifierThe Modifier to be applied to this BottomAppBar
backgroundColorThe background color for the BottomAppBar. Use Color.Transparent to have no color.
contentColorThe preferred content color provided by this BottomAppBar to its children. Defaults to either the matching content color for backgroundColor, or if backgroundColor is not a color from the theme, this will keep the same value set above this BottomAppBar.
cutoutShapethe shape of the cutout that will be added to the BottomAppBar - this should typically be the same shape used inside the FloatingActionButton, when BottomAppBar and FloatingActionButton are being used together in Scaffold. This shape will be drawn with an offset around all sides. If null, where will be no cutout.
elevationthe elevation of this BottomAppBar.
contentPaddingthe padding applied to the content of this BottomAppBar
contentthe content of this BottomAppBar. The default layout here is a Row, so content inside will be placed horizontally