androidx.compose.material3
HorizontalFloatingToolbarSince 1.10
Composable function
A floating toolbar holds actions for the current screen. It floats above the content, so it can show and hide while the user scrolls.

HorizontalFloatingToolbar(expanded = true) {
IconButton(onClick = {}) { Icon(Icons.Filled.Edit, "Edit") }
IconButton(onClick = {}) { Icon(Icons.Filled.Share, "Share") }
IconButton(onClick = {}) { Icon(Icons.Filled.Favorite, "Favorite") }
IconButton(onClick = {}) { Icon(Icons.Filled.Settings, "Settings") }
}
With a FAB, the toolbar collapses into the FAB while the user scrolls, and opens again when they scroll back.

HorizontalFloatingToolbar(
expanded = true,
floatingActionButton = {
FloatingToolbarDefaults.VibrantFloatingActionButton(onClick = {}) { Icon(Icons.Filled.Add, "Add") }
},
colors = FloatingToolbarDefaults.vibrantFloatingToolbarColors(),
) {
IconButton(onClick = {}) { Icon(Icons.Filled.Edit, "Edit") }
IconButton(onClick = {}) { Icon(Icons.Filled.Share, "Share") }
IconButton(onClick = {}) { Icon(Icons.Filled.Favorite, "Favorite") }
}
Place it with Modifier.align(...) in a Box, or in the floatingActionButton slot of a Scaffold.
Basic
Actions only.
@Composable
fun HorizontalFloatingToolbar(
expanded: Boolean,
modifier: Modifier = Modifier,
colors: FloatingToolbarColors = FloatingToolbarDefaults.standardFloatingToolbarColors(),
contentPadding: PaddingValues = FloatingToolbarDefaults.ContentPadding,
scrollBehavior: FloatingToolbarScrollBehavior? = null,
shape: Shape = FloatingToolbarDefaults.ContainerShape,
leadingContent: @Composable (RowScope.() -> Unit)? = null,
trailingContent: @Composable (RowScope.() -> Unit)? = null,
expandedShadowElevation: Dp = FloatingToolbarDefaults.ContainerExpandedElevation,
collapsedShadowElevation: Dp = FloatingToolbarDefaults.ContainerCollapsedElevation,
content: @Composable RowScope.() -> Unit,
)
expanded: BooleanRequired
expanded: BooleanRequiredWhether the toolbar is open. With a FAB, a closed toolbar shows only the FAB.
modifier: ModifierOptional
modifier: ModifierOptionalDefault: Modifier
Changes size, padding, or position. See the Modifier guide.
colors: FloatingToolbarColorsOptional
colors: FloatingToolbarColorsOptionalDefault: FloatingToolbarDefaults.standardFloatingToolbarColors()
Sets toolbar and FAB colors. Use FloatingToolbarDefaults.standardFloatingToolbarColors or FloatingToolbarDefaults.vibrantFloatingToolbarColors for a stronger color.
contentPadding: PaddingValuesOptional
contentPadding: PaddingValuesOptionalDefault: FloatingToolbarDefaults.ContentPadding
Space between the edge of the toolbar and its content.
scrollBehavior: FloatingToolbarScrollBehavior?Optional
scrollBehavior: FloatingToolbarScrollBehavior?OptionalDefault: null
Hides or collapses the toolbar while the user scrolls. Get one from FloatingToolbarDefaults.exitAlwaysScrollBehavior(...).
shape: ShapeOptional
shape: ShapeOptionalDefault: FloatingToolbarDefaults.ContainerShape
Sets the outline. Default: fully round.
leadingContent: @Composable (RowScope.() -> Unit)?Optional
leadingContent: @Composable (RowScope.() -> Unit)?OptionalDefault: null
Items at the start, shown only while the toolbar is open.
trailingContent: @Composable (RowScope.() -> Unit)?Optional
trailingContent: @Composable (RowScope.() -> Unit)?OptionalDefault: null
Items at the end, shown only while the toolbar is open.
expandedShadowElevation: DpOptional
expandedShadowElevation: DpOptionalDefault: FloatingToolbarDefaults.ContainerExpandedElevation
The shadow while the toolbar is open.
collapsedShadowElevation: DpOptional
collapsedShadowElevation: DpOptionalDefault: FloatingToolbarDefaults.ContainerCollapsedElevation
The shadow while the toolbar is closed.
content: @Composable RowScope.() -> UnitRequired
content: @Composable RowScope.() -> UnitRequiredThe actions. Usually IconButtons.
With FAB
Actions plus a floating action button next to them.
@Composable
fun HorizontalFloatingToolbar(
expanded: Boolean,
floatingActionButton: @Composable () -> Unit,
modifier: Modifier = Modifier,
colors: FloatingToolbarColors = FloatingToolbarDefaults.standardFloatingToolbarColors(),
contentPadding: PaddingValues = FloatingToolbarDefaults.ContentPadding,
scrollBehavior: FloatingToolbarScrollBehavior? = null,
shape: Shape = FloatingToolbarDefaults.ContainerShape,
floatingActionButtonPosition: FloatingToolbarHorizontalFabPosition = FloatingToolbarHorizontalFabPosition.End,
animationSpec: FiniteAnimationSpec<Float> = FloatingToolbarDefaults.animationSpec(),
expandedShadowElevation: Dp = FloatingToolbarDefaults.ContainerExpandedElevationWithFab,
collapsedShadowElevation: Dp = FloatingToolbarDefaults.ContainerCollapsedElevationWithFab,
content: @Composable RowScope.() -> Unit,
)
floatingActionButton: @Composable () -> UnitRequired
floatingActionButton: @Composable () -> UnitRequiredThe FAB next to the toolbar. Use FloatingToolbarDefaults.StandardFloatingActionButton or VibrantFloatingActionButton.
floatingActionButtonPosition: FloatingToolbarHorizontalFabPositionOptional
floatingActionButtonPosition: FloatingToolbarHorizontalFabPositionOptionalDefault: FloatingToolbarHorizontalFabPosition.End
Which side the FAB sits on.
animationSpec: FiniteAnimationSpec<Float>Optional
animationSpec: FiniteAnimationSpec<Float>OptionalDefault: FloatingToolbarDefaults.animationSpec()
How the toolbar animates when it opens and closes.
Same as above: expanded, modifier, colors, contentPadding, scrollBehavior, shape, expandedShadowElevation, collapsedShadowElevation, content.
Floating toolbar types
HorizontalFloatingToolbarVerticalFloatingToolbar