Compose Icons

repository·main·Indexed 43 days ago

https://github.com/composablehorizons/compose-icons

A collection of icon libraries for Android and Compose Multiplatform projects, providing icons in Android Vector Drawable (XML) and Compose Image Vector formats. Includes support for Bootstrap, Codicons, Feather, Font Awesome, Heroicons, Lucide, Material Icons, Material Symbols, Radix, and Tabler icons (version 2.2.1).

Tokens
7.1K
Snippets
35
Records
36
Agent score
56%

What's inside Compose Icons

  1. Understand the difference between Android and Compose Multiplatform variants

    main

    Compose Icons provides two distinct variants for every library to suit different project targets:

    1. Android variant: Bundles icons as Android Vector Drawables (XML). These are accessed via the standard R.drawable resource class. This variant is preferred if you want to use Android Studio's built-in XML previews in autocomplete.
    2. Compose Multiplatform (CMP) variant: Adds icons as Compose Image Vectors as extensions to a specific object (e.g., Lucide.Icon). This is designed for multiplatform projects.

    Choose the variant based on your target platform and whether you require XML preview support in Android Studio.

  2. Install Material Symbols

    main

    Add the following dependencies to your build.gradle.kts depending on your target platform. Material Symbols include Outlined, Rounded, Sharp, and Filled variants.

    // Android
    implementation("com.composables:icons-material-symbols-outlined-android:2.2.1")
    implementation("com.composables:icons-material-symbols-rounded-android:2.2.1")
    implementation("com.composables:icons-material-symbols-sharp-android:2.2.1")
    implementation("com.composables:icons-material-symbols-outlined-filled-android:2.2.1")
    implementation("com.composables:icons-material-symbols-rounded-filled-android:2.2.1")
    implementation("com.composables:icons-material-symbols-sharp-filled-android:2.2.1")
    
    // Compose Multiplatform
    implementation("com.composables:icons-material-symbols-outlined-cmp:2.2.1")
    implementation("com.composables:icons-material-symbols-rounded-cmp:2.2.1")
    implementation("com.composables:icons-material-symbols-sharp-cmp:2.2.1")
    implementation("com.composables:icons-material-symbols-outlined-filled-cmp:2.2.1")
    implementation("com.composables:icons-material-symbols-rounded-filled-cmp:2.2.1")
    implementation("com.composables:icons-material-symbols-sharp-filled-cmp:2.2.1")
  3. Use icons in a Compose Multiplatform project

    main

    After adding the CMP-specific dependency (e.g., com.composables:icons-lucide-cmp:2.2.1) to your build.gradle.kts, access icons directly via the library's object extension.

    Replace Library with the specific object name from the library (e.g., Lucide).

    Image(Library.Icon, contentDescription = null)
  4. Install Material Icons

    main

    Add the following dependencies to your build.gradle.kts depending on your target platform. Material Icons are available in Filled, Outlined, Rounded, Sharp, and TwoTone styles.

    // Android
    implementation("com.composables:icons-material-icons-filled-android:2.2.1")
    implementation("com.composables:icons-material-icons-outlined-android:2.2.1")
    implementation("com.composables:icons-material-icons-rounded-android:2.2.1")
    implementation("com.composables:icons-material-icons-sharp-android:2.2.1")
    implementation("com.composables:icons-material-icons-twotone-android:2.2.1")
    
    // Compose Multiplatform
    implementation("com.composables:icons-material-icons-filled-cmp:2.2.1")
    implementation("com.composables:icons-material-icons-outlined-cmp:2.2.1")
    implementation("com.composables:icons-material-icons-rounded-cmp:2.2.1")
    implementation("com.composables:icons-material-icons-sharp-cmp:2.2.1")
    implementation("com.composables:icons-material-icons-twotone-cmp:2.2.1")
  5. Install Bootstrap icons

    main

    Add the following dependencies to your build.gradle.kts depending on your target platform.

    // Android
    implementation("com.composables:icons-bootstrap-fill-android:2.2.1")
    implementation("com.composables:icons-bootstrap-outline-android:2.2.1")
    
    // Compose Multiplatform
    implementation("com.composables:icons-bootstrap-fill-cmp:2.2.1")
    implementation("com.composables:icons-bootstrap-outline-cmp:2.2.1")
  6. Install Font Awesome icons

    main

    Add the following dependencies to your build.gradle.kts depending on your target platform. Font Awesome is split into Solid, Regular, and Brands styles.

    // Android
    implementation("com.composables:icons-font-awesome-solid-android:2.2.1")
    implementation("com.composables:icons-font-awesome-regular-android:2.2.1")
    implementation("com.composables:icons-font-awesome-brands-android:2.2.1")
    
    // Compose Multiplatform
    implementation("com.composables:icons-font-awesome-solid-cmp:2.2.1")
    implementation("com.composables:icons-font-awesome-regular-cmp:2.2.1")
    implementation("com.composables:icons-font-awesome-brands-cmp:2.2.1")
  7. Install Tabler icons

    main

    Add the following dependencies to your build.gradle.kts depending on your target platform. Tabler icons are available in Outline and Filled styles.

    // Android
    implementation("com.composables:icons-tabler-outline-android:2.2.1")
    implementation("com.composables:icons-tabler-filled-android:2.2.1")
    
    // Compose Multiplatform
    implementation("com.composables:icons-tabler-outline-cmp:2.2.1")
    implementation("com.composables:icons-tabler-filled-cmp:2.2.1")
  8. Use icons in an Android project

    main

    After adding the Android-specific dependency (e.g., com.composables:icons-lucide-android:2.2.1) to your build.gradle.kts, access icons using painterResource and the R.drawable class.

    Replace library_ic_icon with the specific drawable resource name provided by the library.

    Icon(
        painterResource(R.drawable.library_ic_icon),
        contentDescription = null
    )
  9. Install Heroicons

    main

    Add the following dependencies to your build.gradle.kts depending on your target platform. Heroicons includes Outline, Solid, Mini, and Micro styles.

    // Android
    implementation("com.composables:icons-heroicons-outline-android:2.2.1")
    implementation("com.composables:icons-heroicons-solid-android:2.2.1")
    implementation("com.composables:icons-heroicons-mini-android:2.2.1")
    implementation("com.composables:icons-heroicons-micro-android:2.2.1")
    
    // Compose Multiplatform
    implementation("com.composables:icons-heroicons-outline-cmp:2.2.1")
    implementation("com.composables:icons-heroicons-solid-cmp:2.2.1")
    implementation("com.composables:icons-heroicons-mini-cmp:2.2.1")
    implementation("com.composables:icons-heroicons-micro-cmp:2.2.1")