Laygent

Laygent is the AI-native Compose layout for token-maxxers.
Describe the layout you want in plain English and the algorithm is written for you at runtime, then
cached so your frames stay fast. The whole library is 100% AI-generated code — the humans just held
the keyboard.
Example
val config = LaygentConfig.defaultOpenAi(openAiApiKey = myOpenAiKey)
@Composable
fun Example() {
val state = rememberLaygentState(config) {
"Arrange items in a 3-column grid with 8 dp of spacing between them."
}
Laygent(state) {
repeat(12) {
Box(Modifier.size(50.dp).background(Color.Blue))
}
}
}
Installation
The library is published to Maven Central:
repositories {
mavenCentral()
}
dependencies {
implementation("com.zachklipp:laygent:0.1.0")
}
Demos
- Desktop:
./gradlew :demo:run — full-featured Compose Desktop demo.
- Web:
./gradlew :demo-web:wasmJsBrowserDevelopmentRun — runs the same Laygent runtime in
the browser via Compose Multiplatform / wasmJs. Once it prints a localhost URL, open it and paste
an OpenAI key to drive the LLM-generated layout.
Targets
The :laygent library publishes for jvm, iosArm64, iosSimulatorArm64, iosX64, and
wasmJs. The host JavaScript runtime is platform-specific:
jvm and the iOS targets use quickjs-kt.
wasmJs uses the browser's JS engine directly via eval and a globalThis.layoutContext bridge.