Material Icons - Jetpack Compose - Android Developers
Material Icons - Jetpack Compose - Android Developers
Material icons
The Icon composable is a convenient way to draw a single color icon on screen that
follows Material Design guidelines
(https://material.io/design/iconography/system-icons.html#grid-and-keyline-shapes). To use Icon ,
include the Compose Material (/jetpack/androidx/releases/compose-material) library (or the
Compose Material 3 (/jetpack/androidx/releases/compose-material3) 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
)
e/snippets/src/main/java/com/example/compose/snippets/images/MaterialIconsSnippets.kt#L47-L50)
Icon(
Icons.Rounded.ShoppingCart,
contentDescription = stringResource(id = R.string.shopping_cart_content_de
)
se/snippets/src/main/java/com/example/compose/snippets/images/MaterialIconsSnippets.kt#L54-L57)
https://developer.android.com/develop/ui/compose/graphics/images/material 1/2
8/9/24, 10:34 AM Material icons | Jetpack Compose | Android Developers
It's worth noting that it's not required to use Icon to render a VectorDrawable on
screen, under the hood, Icon uses
Modifier.paint(painterResource(R.drawable.ic_bus_stop) ) to draw the Icon on
screen. For more information on all the available icons, take a look at the Icons
documentation (/reference/kotlin/androidx/compose/material/icons/package-summary).
Previous
arrow_back ImageBitmap vs ImageVector (/develop/ui/compose/graphics/images/compare)
Next
Customize an image (/develop/ui/compose/graphics/images/customize) arrow_forward
Content and code samples on this page are subject to the licenses described in the Content License
(/license). Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://developer.android.com/develop/ui/compose/graphics/images/material 2/2