Compose Unstyled 2.0 is out! Check the official announcement blog ->

An icon component for tinted painter, bitmap, and vector assets.

import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.composables.icons.lucide.Heart
import com.composables.icons.lucide.Lucide
import com.composeunstyled.UnstyledIcon

@Composable
fun IconDemo() {
  UnstyledIcon(
    imageVector = Lucide.Heart,
    contentDescription = "Favorite",
    tint = Color.Black,
    modifier = Modifier.size(90.dp),
  )
}

Installation

implementation("com.composables:composeunstyled-icon")

Anatomy

UnstyledIcon(
  imageVector = icon,
  contentDescription = "Favorite",
)

Concepts

  • UnstyledIcon renders an icon from an ImageVector, Painter, or ImageBitmap.

Accessibility

Pass a short contentDescription for icons that communicate meaning. Use null for decorative icons.

Code Examples

Tinting an icon

Use the tint parameter to apply one color to the icon:

UnstyledIcon(
  imageVector = favoriteIcon,
  contentDescription = "Favorite",
  tint = Color.Red,
)

API Reference

UnstyledIcon

Parameter Type Description
painter Painter a Painter to draw inside this icon.
contentDescription String? text used by accessibility services to describe what this icon represents. This value can be ommited if the icon is used for stylistic purposes only.
modifier Modifier the Modifier to be used to this icon.
tint Color a Color that will be used to tint the painter. If Color.Unspecified is passed, then no tinting will be used.
imageBitmap ImageBitmap an ImageBitmap to draw inside this icon.
imageVector ImageVector a ImageVector to draw inside this icon.