androidx.compose.material3
Icon
Composable function
Icon draws a small image in one color. By default it is 24 dp and takes the color of the surrounding component, so an icon inside a button gets the button's text color.

Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
Icon(Icons.Filled.Star, contentDescription = "Favorite")
Icon(Icons.Filled.Star, contentDescription = null, tint = MaterialTheme.colorScheme.primary)
Icon(Icons.Filled.Star, contentDescription = null, modifier = Modifier.size(40.dp))
}
Material icons are in the Icons object, for example Icons.Filled.Star. The basic set comes with material-icons-core. For your own icons, use a vector resource and painterResource().
Vector
Takes an ImageVector, like Icons.Filled.Star.
@Composable
fun Icon(
imageVector: ImageVector,
contentDescription: String?,
modifier: Modifier = Modifier,
tint: Color = LocalContentColor.current,
)
imageVector: ImageVectorRequired
imageVector: ImageVectorRequiredThe icon, for example Icons.Filled.Star.
contentDescription: String?Required
contentDescription: String?RequiredWhat the icon means, for screen readers. Like "Delete" or "Settings".
Pass null when the icon is only decoration, or when a text next to it already says the same.
modifier: ModifierOptional
modifier: ModifierOptionalDefault: Modifier
Changes size, padding, or position of the icon. Set the size with Modifier.size(...).
tint: ColorOptional
tint: ColorOptionalDefault: LocalContentColor.current
The color. Default: LocalContentColor, the color of the surrounding component.
Pass Color.Unspecified to draw the image in its own colors.
Bitmap
Takes an ImageBitmap.
@Composable
fun Icon(
bitmap: ImageBitmap,
contentDescription: String?,
modifier: Modifier = Modifier,
tint: Color = LocalContentColor.current,
)
bitmap: ImageBitmapRequired
bitmap: ImageBitmapRequiredThe icon as a bitmap image.
Same as above: contentDescription, modifier, tint.
Painter
Takes a Painter, for example from a resource file.
@Composable
fun Icon(
painter: Painter,
contentDescription: String?,
modifier: Modifier = Modifier,
tint: Color = LocalContentColor.current,
)
Same as above: contentDescription, modifier, tint.
Painter, changing tint
Takes tint as a function, for colors that animate often.
@Composable
fun Icon(
painter: Painter,
tint: ColorProducer?,
contentDescription: String?,
modifier: Modifier = Modifier,
)
tint: ColorProducer?Required
tint: ColorProducer?RequiredThe color. Default: LocalContentColor, the color of the surrounding component.
Pass Color.Unspecified to draw the image in its own colors.
Same as above: painter, contentDescription, modifier.