StatusIconButton

fun StatusIconButton(isChecked: Boolean, icon: Painter, activeIcon: Painter, onCheckedChange: (Boolean) -> Unit, modifier: Modifier = Modifier, isEnabled: Boolean = true, buttonVariant: IconButtonVariant = IconButtonVariant.Positive, contentDescription: String? = null, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

Informs users of a changed state within an icon through visual cues for improved awareness and scannability. The state of this button often reflects the system state or the user's interaction with them, helping to communicate feedback or guide behavior. It comes in two IconButtonVariants.

Example - a heart icon changes from outlined to filled style on a tap/click to indicate that item is added to wish-list.

IconButtonVariant.Positive

Positive Status Icon Button Sample

If need be, the button can be disabled: Disabled Positive Status Icon Button Sample

IconButtonVariant.Discrete

Discrete Status Icon Button Sample

If need be, the button can be disabled: Disabled Discrete Status Icon Button Sample

Parameters

isChecked

Whether the button is currently checked.

icon

The painter for the icon to display when the button is unchecked.

activeIcon

The painter for the icon to display when the button is checked.

onCheckedChange

Callback invoked when the checked state of the button changes.

modifier

The Modifier to be applied to the button.

isEnabled

Whether the button is enabled.

buttonVariant

The variant of the button, which determines its appearance.

contentDescription

Text used by accessibility services to describe what this icon button represents. This should always be provided unless this icon button is used for decorative purposes, and does not represent a user action.

interactionSource

The MutableInteractionSource representing the stream of Interactions for this button. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this button in different states.