Installation
Add Pantrix UI to a Compose Multiplatform project, wrap the app in its theme and draw the first component. One dependency in the common source set serves every target.
What it needs
- Kotlin
- 2.4.21 or newer
- Compose Multiplatform
- 1.12.2 or newer
- Android
- API 30, Android 11
- iOS
- Arm64, simulator
- Desktop and web
- JVM, Wasm, JS
Add the repository
In
settings.gradle.kts, next to Google's and Maven Central:GitHub Packages
settings.gradle.ktsdependencyResolutionManagement { repositories { maven { name = "GitHubPackages" url = uri("https://maven.pkg.github.com/develappsancho/pantrix-ui-cmp-package") credentials(PasswordCredentials::class) } google() mavenCentral() } }Local Maven
settings.gradle.ktsdependencyResolutionManagement { repositories { mavenLocal() google() mavenCentral() } }Add the dependency
One line in the common source set. Gradle picks each target's build, and
foundationcomes with it, soPantrixThemeis there at once.build.gradle.ktskotlin { sourceSets { commonMain.dependencies { implementation("com.pantrixui:components:0.1.0-alpha03") } commonTest.dependencies { implementation("com.pantrixui:testing:0.1.0-alpha03") } } }The other modules com.pantrixui:testingFinding by tag, PantrixTestTheme, doubles of the platform's services and assertionscom.pantrixui:material3The bridge to Material 3, both ways, for an app that moves a screen at a time com.pantrixui:detekt-rulesThe rules an app keeps, for detektPluginscom.pantrixui:mcpThe MCP server, for coding assistants Wrap the app in the theme
The theme reads the platform, the system's dark mode, its reduced motion and its language. Every component under it follows them.
App.ktimport com.pantrixui.components.elements.button.PantrixButton import com.pantrixui.foundation.theme.PantrixTheme @Composable fun App() { PantrixTheme { PantrixButton(text = stringResource(Res.string.save), onClick = { /* … */ }, tagKey = "save") } }Give it your brand
A
DesignPresetholds a brand's colours for light and dark, its type, its shapes and any component's overrides. The theme builder writes one for you.PantrixPreset.ktobject PantrixPreset : DesignPreset { override val name = "Pantrix" override fun colors(dark: Boolean) = if (dark) PantrixDark else PantrixLight @Composable override fun typography() = rememberPantrixTypography() @Composable override fun shapes() = rememberPantrixShapes() } PantrixTheme(preset = PantrixPreset) { App() }
On each platform
- iOS
- The fold's bridge comes with the library: no cinterop of your own and no
enableCInteropCommonization. - Web
- Plus Jakarta Sans ships in the app's resources. A page that loads it before Compose starts shows no change of type: Web fonts.
- Android
- Nothing to add: the outermost theme makes tags the resource ids Maestro and UI Automator find. A
PopuporDialogof the app's own putsModifier.pantrixAutomationRoot()on its root.
Where next
- Your first form: Text fields, a text area and FormState.
- Theming: Colour roles, type, shapes and motion.
- Adaptive layout: Size classes, panes and folds.
- Testing: Tags, PantrixTestTheme and Maestro.