Install SaltUI
Add SaltUI to an existing Compose Multiplatform project and wrap your UI in SaltTheme.
Add the dependency
Add mavenCentral() to your project's dependency repositories. In a shared module, add the dependency to commonMain. In an Android-only project, use the module's dependencies block.
commonMain.dependencies {
implementation("io.github.moriafly:salt-ui:3.1.0-alpha02")
}The example uses the published 3.1.0-alpha02 from Maven Central. Check the matching Compose compatibility table and release notes.
Modules
| Module | Artifact under io.github.moriafly | When to use it |
|---|---|---|
| UI | salt-ui | Themes and UI components. Includes Core and Adaptive Window transitively. |
| Navigation | salt-ui-navigation | Navigation 3 integration with a back and forward stack. |
| Core | salt-core | Platform utilities in a module that uses only Core. |
| Adaptive Window | salt-adaptive-window | Window information in a module that uses only Adaptive Window. |
Use the same version for all SaltUI artifacts. The UI module requires Android API 23 or later. The Navigation module requires API 24 or later. See Android for application setup.
Build your first screen
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import com.moriafly.salt.ui.SaltConfigs
import com.moriafly.salt.ui.SaltTheme
import com.moriafly.salt.ui.Text
@Composable
fun App() {
SaltTheme(
configs = SaltConfigs.default(isDarkTheme = false)
) {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Text(text = "Hello, SaltUI")
}
}
}This example uses light mode. To follow the system, pass the result of isSystemInDarkTheme() to SaltConfigs.default(isDarkTheme = ...). For colors, typography, and shapes, see Theme.
Use SaltUI alongside Material or Material 3
Import the SaltUI versions of Text and Icon to read colors and styles from SaltTheme.
import com.moriafly.salt.ui.Icon
import com.moriafly.salt.ui.TextProvide MaterialTheme to Material 3 components and explicitly map any colors you want to share between themes.
Unstable APIs
Opt in at the use site for APIs marked with @UnstableSaltUiApi. Core and Adaptive Window have their own opt-in annotations.
import com.moriafly.salt.ui.UnstableSaltUiApi
@OptIn(UnstableSaltUiApi::class)
@Composable
fun SettingsPage() {
// Call APIs marked with UnstableSaltUiApi.
}Check the source and release notes for the version you use when upgrading.
Next steps
- Build a screen with a title bar and settings sections.
- Choose settings rows for input and selection.
- Set up Material for shared backdrops or Glass for floating controls.