State of Compose 2023 results are in! Click here to learn more

← Back to Material Compose

IconButton

Component
in
Material
. Since 0.1.0-dev15

Overview

Code Examples

Video

IconButton is a clickable icon, used to represent actions. An IconButton has an overall minimum touch target size of 48 x 48dp, to meet accessibility guidelines. content is centered inside the IconButton.

This component is typically used inside an App Bar for the navigation icon / actions. See App Bar documentation for samples of this.

content should typically be an Icon, using an icon from androidx.compose.material.icons.Icons. If using a custom icon, note that the typical size for the internal icon is 24 x 24 dp.

Overloads

IconButton

@Composable
fun IconButton(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
    content: @Composable () -> Unit
)

Parameters

NameDescription
onClickthe lambda to be invoked when this icon is pressed
modifieroptional Modifier for this IconButton
enabledwhether or not this IconButton will handle input events and appear enabled for semantics purposes
interactionSourcethe MutableInteractionSource representing the stream of Interactions for this IconButton. You can create and pass in your own remembered MutableInteractionSource if you want to observe Interactions and customize the appearance / behavior of this IconButton in different Interactions.
contentthe content (icon) to be drawn inside the IconButton. This is typically an Icon