microsoft / fluentui-system-icons

Fluent System Icons are a collection of familiar, friendly and modern icons from Microsoft.
https://aka.ms/fluentui-system-icons
MIT License
6.03k stars 524 forks source link

Jetpack Compose support #302

Open adrientetar opened 3 years ago

adrientetar commented 3 years ago

There's a nice Material icons library in Jetpack Compose that makes icons accessible from code:

IconButton(onClick = { /* doSomething() */ }) {
    Icon(Icons.Filled.Favorite, contentDescription = "Localized description")
}

https://developer.android.com/reference/kotlin/androidx/compose/material/icons/package-summary

Would be great to have the same but with Fluent icons!

willhou commented 3 years ago

Thanks, we could look into this!

Currently the library is usable in Jetpack Compose. Because all the icons in the Android library are in the Vector Drawable format, you could load them by calling painterResource() in Jetpack Compose:

Icon(
    painter = painterResource(id = R.drawable.ic_fluent_...),
    contentDescription = "Localized description"
)