IconToggleButton
Source set: Android
@Composable
public fun IconToggleButton(
checked: Boolean,
onCheckedChange: (Boolean) -> Unit,
modifier: Modifier = Modifier,
shape: Shape = IconToggleButtonDefaults.animateShape(checked),
colors: IconToggleButtonColors = IconToggleButtonDefaults.colors(),
border: BorderStroke? = SurfaceDefaults.border(),
enabled: Boolean = true,
contentPadding: PaddingValues = IconToggleButtonDefaults.contentPadding,
interactionSource: MutableInteractionSource? = null,
content: @Composable () -> Unit,
)
Parameters
| checked | a boolean flag indicating whether this icon toggle button is currently checked. |
| onCheckedChange | a callback to be invoked when this button is clicked, receiving the inverted checked value. |
| modifier | the Modifier to be applied to this icon toggle button. |
| shape | the Shape of this icon toggle button. It is recommended to change the shape depending on the checked state. IconToggleButtonDefaults provides both animated and non-animated versions, see IconToggleButtonDefaults.animateShape and IconToggleButtonDefaults.shape for more details. |
| colors | the IconToggleButtonColors providing color variants for all icon toggle button states. |
| border | the border to draw around this icon toggle button. |
| enabled | controls the enabled state of this icon toggle button. When false, this button will not respond to user input. |
| contentPadding | the spacing values to apply internally between the container and the content. |
| interactionSource | an optional hoisted MutableInteractionSource for observing and emitting Interactions for this button. You can use this to change the icon toggle button's appearance or preview it in different states. Note that if null is provided, interactions will still happen internally. |
| content | the content of this icon toggle button, typically an Icon. |