MaleficComponents
2.1.1indexedOffers cross-platform UI elements and components, such as typography and layout tools, for creating mobile and desktop applications with consistent theming and customization.
Offers cross-platform UI elements and components, such as typography and layout tools, for creating mobile and desktop applications with consistent theming and customization.
A Kotlin Multiplatform Compose library containing useful UI elements and components for Android, JVM (Desktop), and iOS platforms.
MaleficComponents is built with Kotlin Multiplatform, providing seamless cross-platform support:
All core UI components are available across all platforms through the commonMain source set:
NavWindow - Desktop window wrapper with PreCompose integrationMaleficBox - Malefic theming integration (requires JVM-only theming library)Add the dependency to your build.gradle.kts:
dependencies {
implementation("xyz.malefic.compose:comps:1.2.1")
}
kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("xyz.malefic.compose:comps:1.2.1")
}
}
}
}
@Composable
fun MyApp() {
val switchState = remember { mutableStateOf(false) }
MaterialBox(colors = MaterialTheme.colors) {
Column {
Heading1("Welcome to MaleficComponents!")
Body1("Cross-platform UI components for Compose")
BooleanSwitch(state = switchState)
BackgroundBox {
Body1("This content has a background.")
}
}
}
}
@Composable
fun DesktopApp() {
NavWindow(
onCloseRequest = { exitApplication() },
title = "My Desktop App"
) {
MyApp() // Your common composable
}
}
The library follows Kotlin Multiplatform best practices:
src/
├── commonMain/ # Shared code for all platforms
│ └── kotlin/
│ └── xyz/malefic/compose/comps/
│ ├── box/ # Layout components
│ ├── switch/ # Input components
│ └── text/ # Typography components
├── jvmMain/ # JVM/Desktop specific code
│ └── kotlin/
│ └── xyz/malefic/compose/comps/
│ ├── box/ # Desktop theming integration
│ └── precompose/ # Desktop window components
├── androidMain/ # Android specific code (currently empty)
└── iosMain/ # iOS specific code (currently empty)
MIT License - see LICENSE for details.
Contributions are welcome! Please ensure that any new components maintain cross-platform compatibility by placing shared code in commonMain and platform-specific implementations in their respective source sets.
Heading1 through Heading6, Body1, Body2 with customizable colorsMaterialBox, BackgroundBox for themed containersBooleanSwitch for toggle functionalityColorType enum for consistent themingSurfaced from shared tags and platforms — no rankings paid for.