Skip to content

Latest commit

 

History

History
156 lines (139 loc) · 4.64 KB

README.md

File metadata and controls

156 lines (139 loc) · 4.64 KB

Compose Font Icons for Kotlin Multiplatform

License GitHub release Maven Central Version GitHub Actions Workflow Status

Makes possible to use icons from a font in JetBrains Compose Multiplatform. Currently supported targets are Android, Desktop (JVM), Web (JS and WASM), MacOS, and iOS. An additional library is available for AndroidX Glance (Android App Widgets / WearOS Tiles).

This library supports the Compose Multiplatform Common resources API alongside platform-specific resources like resource IDs for Android, classpath resources for JVM...

Setup

This library is available on Maven Central and GitHub Packages.

Add this to your build.gradle(.kts):

dependencies {
    implementation("dev.tclement.fonticons:ARTIFACT:VERSION")
}

Artifacts

Artifact Artifact description Supported platforms
Android Desktop (JVM) Kotlin/JS Kotlin/WASM iOS MacOS
core Main artifact ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
core-glance AndroidX Glance support ✔️
font-symbols Material Symbols fonts ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
font-symbols-outlined ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
font-symbols-rounded ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
font-symbols-sharp ✔️ ✔️ ✔️ ✔️ ✔️ ✔️

Warning

iOS and macOS are not tested as much as the other targets.

Usage

Set the default icon parameters:

ProvideIconParameters(
    iconFont = rememberVariableIconFont(params...), // ex: for outlined symbols: rememberOutlinedMaterialSymbolsFont()
    tintProvider = LocalContentColor
) {
    // icons here will have by default the params declared above
}

Then:

FontIcon(
    iconName = "account_circle",
    contentDescription = null
)

Or for Material Symbols:

FontIcon(
    icon = MaterialSymbols.AccountCircle,
    contentDescription = null
)

Read the full doc here.

License

     Copyright 2024 T. Clément (@tclement0922) and contributors
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
      http://www.apache.org/licenses/LICENSE-2.0
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.