IconButton

Composable Component

Wear Material IconButton is a circular, icon-only button with transparent background and no border. It offers a single slot to take icon or image content.

Android
@Composable
public fun IconButton(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    onLongClick: (() -> Unit)? = null,
    onLongClickLabel: String? = null,
    enabled: Boolean = true,
    shapes: IconButtonShapes = IconButtonDefaults.shapes(),
    colors: IconButtonColors = IconButtonDefaults.iconButtonColors(),
    border: BorderStroke? = null,
    interactionSource: MutableInteractionSource? = null,
    content: @Composable BoxScope.() -> Unit,
)

Parameters

onClickWill be called when the user clicks the button.
modifierModifier to be applied to the button.
onLongClickCalled when this button is long clicked (long-pressed). When this callback is set, onLongClickLabel should be set as well.
onLongClickLabelSemantic / accessibility label for the onLongClick action.
enabledControls the enabled state of the button. When false, this button will not be clickable.
shapesDefines the shape for this button. Defaults to a static shape based on IconButtonDefaults.shape, but animated versions are available through IconButtonDefaults.animatedShapes.
colorsIconButtonColors that will be used to resolve the background and icon color for this button in different states.
borderOptional BorderStroke for the icon button border.
interactionSourcean optional hoisted MutableInteractionSource for observing and emitting Interactions for this button. You can use this to change the button's appearance or preview the button in different states. Note that if null is provided, interactions will still happen internally.
contentThe content displayed on the icon button, expected to be icon or image.