androidx.compose.material3
ExtendedFloatingActionButton
Composable function
One of the fab types. It works like FloatingActionButton. Only the parameters that differ are described here.
A FAB with a text label. Set expanded to false to show only the icon, for example while the user scrolls.

ExtendedFloatingActionButton(
onClick = {},
icon = { Icon(Icons.Filled.Edit, contentDescription = null) },
text = { Text("Compose") },
)
With content
You place the icon and text yourself.
@Composable
fun ExtendedFloatingActionButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
shape: Shape = FloatingActionButtonDefaults.extendedFabShape,
containerColor: Color = FloatingActionButtonDefaults.containerColor,
contentColor: Color = contentColorFor(containerColor),
elevation: FloatingActionButtonElevation = FloatingActionButtonDefaults.elevation(),
interactionSource: MutableInteractionSource? = null,
content: @Composable RowScope.() -> Unit,
)
content: @Composable RowScope.() -> UnitRequired
content: @Composable RowScope.() -> UnitRequiredWhat the FAB shows. Usually one Icon with a contentDescription, because there is no text to explain it.
On medium and large FABs, size the icon with FloatingActionButtonDefaults.MediumIconSize or LargeIconSize.
Defaults that differ from FloatingActionButton:
Same as in FloatingActionButton: onClick, modifier, shape, containerColor, contentColor, elevation, interactionSource.
Icon and text
Takes icon and text separately, and can collapse to the icon.
@Composable
fun ExtendedFloatingActionButton(
text: @Composable () -> Unit,
icon: @Composable () -> Unit,
onClick: () -> Unit,
modifier: Modifier = Modifier,
expanded: Boolean = true,
shape: Shape = FloatingActionButtonDefaults.extendedFabShape,
containerColor: Color = FloatingActionButtonDefaults.containerColor,
contentColor: Color = contentColorFor(containerColor),
elevation: FloatingActionButtonElevation = FloatingActionButtonDefaults.elevation(),
interactionSource: MutableInteractionSource? = null,
)
text: @Composable () -> UnitRequired
text: @Composable () -> UnitRequiredThe label of an extended FAB. Hidden when expanded is false.

ExtendedFloatingActionButton(
onClick = {},
icon = { Icon(Icons.Filled.Edit, contentDescription = null) },
text = { Text("Compose") },
)
icon: @Composable () -> UnitRequired
icon: @Composable () -> UnitRequiredThe icon of an extended FAB.
expanded: BooleanOptional
expanded: BooleanOptionalDefault: true
Shows or hides the text. Set it to false while the user scrolls down, to make the FAB small. The change is animated.

ExtendedFloatingActionButton(
onClick = {},
expanded = false,
icon = { Icon(Icons.Filled.Edit, contentDescription = "Compose") },
text = { Text("Compose") },
)
Defaults that differ from FloatingActionButton:
Same as in FloatingActionButton: onClick, modifier, shape, containerColor, contentColor, elevation, interactionSource.
FAB types
FloatingActionButtonSmallFloatingActionButtonMediumFloatingActionButtonLargeFloatingActionButtonExtendedFloatingActionButtonSmallExtendedFloatingActionButtonMediumExtendedFloatingActionButtonLargeExtendedFloatingActionButton
See also
FloatingActionButtonDefaults: default values and helper functions forExtendedFloatingActionButton.