Floating toolbar

A toolbar that floats above content with actions for the current context.

When to use

Floating toolbars hold actions that relate to what is on screen, such as text formatting. They can sit horizontally or vertically, with or without a FAB, and collapse when the user scrolls.

Standard colors blend into the surface. Vibrant colors draw attention to the toolbar.

Playground

The interactive page has a playground with live property controls for this component and generated code.

Examples

With FAB

Box(Modifier.fillMaxWidth().height(160.dp), contentAlignment = Alignment.Center) {
    HorizontalFloatingToolbar(
        expanded = true,
        floatingActionButton = {
            FloatingToolbarDefaults.StandardFloatingActionButton(onClick = {}) {
                Icon(Icons.Rounded.Edit, contentDescription = "Edit")
            }
        },
    ) {
        IconButton(onClick = {}) { Icon(Icons.Rounded.FormatBold, contentDescription = "Bold") }
        IconButton(onClick = {}) { Icon(Icons.Rounded.FormatItalic, contentDescription = "Italic") }
        IconButton(onClick = {}) { Icon(Icons.Rounded.Straighten, contentDescription = "Ruler") }
    }
}

Parameters

NameTypeDefaultDescription
expandedBooleanWhether all actions are visible. When false only the FAB remains.
colorsFloatingToolbarColorsstandardFloatingToolbarColors()Standard or vibrant.
scrollBehaviorFloatingToolbarScrollBehavior?nullCollapse on scroll.
floatingActionButton@Composable () -> UnitOptional FAB, paired with the toolbar.

Guidelines

Do:

Don't:

Accessibility

Related components