androidx.compose.material3

ToggleFloatingActionButtonSince 1.10

Composable function

A part of FloatingActionButtonMenu. See that page for an overview and examples.

Parameters

@Composable
fun ToggleFloatingActionButton(
    checked: Boolean,
    onCheckedChange: (Boolean) -> Unit,
    modifier: Modifier = Modifier,
    containerColor: (Float) -> Color = ToggleFloatingActionButtonDefaults.containerColor(),
    contentAlignment: Alignment = Alignment.TopEnd,
    containerSize: (Float) -> Dp = ToggleFloatingActionButtonDefaults.containerSize(),
    containerCornerRadius: (Float) -> Dp = ToggleFloatingActionButtonDefaults.containerCornerRadius(),
    content: @Composable ToggleFloatingActionButtonScope.() -> Unit,
)

checked: BooleanRequired

Whether the toggle button is in the open state.

onCheckedChange: (Boolean) -> UnitRequired

Called with the new value when the toggle button is clicked. Update your state here.

containerColor: (Float) -> ColorOptional

Default: ToggleFloatingActionButtonDefaults.containerColor()

The background color. For the toggle button, a function of the progress, from closed to open color.

contentAlignment: AlignmentOptional

Default: Alignment.TopEnd

Where the icon sits while the toggle button changes size.

containerSize: (Float) -> DpOptional

Default: ToggleFloatingActionButtonDefaults.containerSize()

The size of the toggle button, as a function of the progress. Use the sizes in ToggleFloatingActionButtonDefaults.

containerCornerRadius: (Float) -> DpOptional

Default: ToggleFloatingActionButtonDefaults.containerCornerRadius()

The corner radius of the toggle button, as a function of the progress.

content: @Composable ToggleFloatingActionButtonScope.() -> UnitRequired

The actions. Add one FloatingActionButtonMenuItem each.

Same as in FloatingActionButtonMenu: modifier.

Parts