androidx.compose.material3
MediumExtendedFloatingActionButtonSince 1.10
Composable function
One of the fab types. It works like FloatingActionButton. Only the parameters that differ are described here.
An Expressive extended FAB, medium size.

MediumExtendedFloatingActionButton(
text = { Text("Compose") },
icon = { Icon(Icons.Filled.Edit, null, Modifier.size(FloatingActionButtonDefaults.MediumIconSize)) },
onClick = {},
)
With content
You place the icon and text yourself.
@Composable
fun MediumExtendedFloatingActionButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
shape: Shape = FloatingActionButtonDefaults.mediumExtendedFabShape,
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 MediumExtendedFloatingActionButton(
text: @Composable () -> Unit,
icon: @Composable () -> Unit,
onClick: () -> Unit,
modifier: Modifier = Modifier,
expanded: Boolean = true,
shape: Shape = FloatingActionButtonDefaults.mediumExtendedFabShape,
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 forMediumExtendedFloatingActionButton.