StandardIconButton

fun StandardIconButton(icon: Painter, onClick: () -> Unit, modifier: Modifier = Modifier, isEnabled: Boolean = true, buttonVariant: IconButtonVariant = IconButtonVariant.Positive, buttonSize: StandardIconButtonSize = StandardIconButtonSize.Medium, contentDescription: String? = null, notificationIndicatorAppearance: NotificationIndicatorAppearance? = null, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

Icon buttons fulfill functional needs of UI designs in places where traditional CTA buttons would have too strong visual emphasis. It comes in two IconButtonVariants, and two StandardIconButtonSizes

Note: Avoid using notificationIndicator in the modifier, because then, it will be show over the whole StandardIconButton instead of the Icon.

IconButtonVariant.Positive

Positive Standard Icon Button Sample

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

IconButtonVariant.Discrete

Discrete Standard Icon Button Sample

If need be, the button can be disabled: Disabled Discrete Standard 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.

buttonVariant

Optional IconButtonVariant of the button. Defaults to IconButtonVariant.Positive.

buttonSize

Optional StandardIconButtonSize of the button. Defaults to StandardIconButtonSize.Medium.

contentDescription

The String describing the icon button for accessibility.

notificationIndicatorAppearance

Optional NotificationIndicatorAppearance of the button. Only applicable for StandardIconButtonSize.Medium. Defaults to null.

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.