State of Compose 2023 results are in! Click here to learn more

← Back to Material Compose

IconToggleButton

Component
in
Material
. Since 0.1.0-dev15

Overview

Code Examples

An IconButton with two states, for icons that can be toggled 'on' and 'off', such as a bookmark icon, or a navigation icon that opens a drawer.

Overloads

IconToggleButton

@Composable
fun IconToggleButton(
    checked: Boolean,
    onCheckedChange: (Boolean) -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
    content: @Composable () -> Unit
)

Parameters

NameDescription
checkedwhether this IconToggleButton is currently checked
onCheckedChangecallback to be invoked when this icon is selected
modifieroptional Modifier for this IconToggleButton
enabledenabled whether or not this IconToggleButton will handle input events and appear enabled for semantics purposes
interactionSourcethe MutableInteractionSource representing the stream of Interactions for this IconToggleButton. You can create and pass in your own remembered MutableInteractionSource if you want to observe Interactions and customize the appearance / behavior of this IconToggleButton in different Interactions.
contentthe content (icon) to be drawn inside the IconToggleButton. This is typically an Icon