The aether-ui module provides a type-safe Kotlin DSL for building HTML user interfaces. It is designed for Server-Side Rendering (SSR) and can serialize the UI tree to CBOR for efficient transport.
The DSL uses the ComposableScope to build a tree of UiNode elements.
exchange.render {
html {
head {
title { text("My Aether App") }
}
body {
div(mapOf("class" to "container")) {
h1 { text("Welcome") }
p { text("This is rendered on the server.") }
}
}
}
}Creates a generic HTML element.
Creates a text node.
The DSL provides helper functions for standard HTML tags:
html,head,bodydiv,span,p,h1...h6a,button,input,formul,ol,litable,tr,td,th
The UI tree is built using UiNode classes, which are marked as @Serializable. This allows the entire UI structure to be serialized (e.g., to JSON or CBOR) and sent to the client, enabling "UI over the wire" architectures or hydration on the client side.
@Serializable
sealed class UiNode {
data class Element(...) : UiNode()
data class Text(...) : UiNode()
}