IconToggleButton

Composable Component

Wear Material IconToggleButton is a filled icon toggle button which switches between primary colors and tonal colors depending on checked value, and offers a single slot for icon or image.

Android
@Composable
public fun IconToggleButton(
    checked: Boolean,
    onCheckedChange: (Boolean) -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    colors: IconToggleButtonColors = IconToggleButtonDefaults.colors(),
    interactionSource: MutableInteractionSource? = null,
    shapes: IconToggleButtonShapes = IconToggleButtonDefaults.shapes(),
    border: BorderStroke? = null,
    content: @Composable BoxScope.() -> Unit,
)

Parameters

checkedBoolean flag indicating whether this toggle button is currently checked.
onCheckedChangeCallback to be invoked when this toggle button is clicked.
modifierModifier to be applied to the toggle button.
enabledControls the enabled state of the toggle button. When false, this toggle button will not be clickable.
colorsIconToggleButtonColors that will be used to resolve the container and content color for this toggle button.
interactionSourcean optional hoisted MutableInteractionSource for observing and emitting Interactions for this button. You can use this to change the button's appearance or preview the button in different states. Note that if null is provided, interactions will still happen internally.
shapesDefines the shape for this toggle button. Defaults to a static shape based on IconToggleButtonDefaults.shape, but animated versions are available through IconToggleButtonDefaults.animatedShapes and IconToggleButtonDefaults.variantAnimatedShapes.
borderOptional BorderStroke for the IconToggleButton.
contentThe content to be drawn inside the toggle button.