PrimaryIconButton

fun PrimaryIconButton(icon: Painter, onClick: () -> Unit, modifier: Modifier = Modifier, isEnabled: Boolean = true, contentDescription: String? = null, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

The Primary Icon Button serves as a visually prominent interactive element for high-priority, icon-only actions. It is typically used in scenarios where a traditional primary button would be placed, but the action is better represented by a single, recognizable icon (e.g., quick add to cart):

Primary Icon Button Sample

If need be, the button can also be disabled:

Primary Icon Button Sample

Parameters

icon

The Painter for the icon to display.

onClick

The action to perform when the button is clicked. Not performed when the button is disabled.

modifier

Optional Modifier to be applied to the PrimaryIconButton. Defaults to Modifier.

isEnabled

Whether the button is enabled or not. Defaults to true.

contentDescription

The String describing the icon button for accessibility.

interactionSource

Optional hoisted MutableInteractionSource for observing and emitting Interactions for this icon button. You can use this to change the button's appearance or preview the button in different states. Defaults to a remembered MutableInteractionSource.