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.
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))
}
}
}The library is published to Maven Central:
repositories {
mavenCentral()
}
dependencies {
implementation("com.zachklipp:laygent:0.1.0")
}- 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.
The :laygent library publishes for jvm, iosArm64, iosSimulatorArm64, iosX64, and
wasmJs. The host JavaScript runtime is platform-specific:
jvmand the iOS targets use quickjs-kt.wasmJsuses the browser's JS engine directly viaevaland aglobalThis.layoutContextbridge.
0 comments
log in to comment.