The Icon composable is a convenient way to draw a single color icon on screen
that follows Material Design guidelines. To use Icon, include
the Compose Material library (or the Compose Material 3 library).
For example, if you had a vector drawable that you wanted to load up with
Material defaults, you can use the Icon composable as follows:
Icon( painter = painterResource(R.drawable.baseline_directions_bus_24), contentDescription = stringResource(id = R.string.bus_content_description) )
By default, the Icon composable is tinted with LocalContentColor.current and
is 24.dp in size. It also exposes a tint color parameter (which leverages
the same mechanism for tinting as described in the Image tint section). The
Icon composable is intended for use for small icon elements. You should use
the Image composable for more customization options.
Recommended for you
- Note: link text is displayed when JavaScript is off
- Resources in Compose
- Accessibility in Compose
- Loading images {:#loading-images}