Official JetBrains Project Download TeamCity (simple build status) Kotlin GitHub license

kotlinx.html

A kotlinx.html library provides DSL to build HTML to Writer/Appendable or DOM at JVM and browser (or other JavaScript engine) for better Kotlin programming for Web.

Get started

See Getting started page for details how to include the library

DOM

You can build DOM tree with JVM and JS naturally

See example for JavaScript-targeted Kotlin

window.setInterval({
    val myDiv = document.create.div("panel") {
        p { 
            +"Here is "
            a("http://kotlinlang.org") { +"official Kotlin site" } 
        }
    }

    document.getElementById("container")!!.appendChild(myDiv)

    document.getElementById("container")!!.append {
        div {
            +"added it"
        }
    }
}, 1000L)

Stream

You can build HTML directly to Writer (JVM only) or Appendable (both JVM and JS)

System.out.appendHTML().html {
	body {
		div {
			a("http://kotlinlang.org") {
				target = ATarget.blank
				+"Main site"
			}
		}
	}
}

Documentation

See wiki pages

Building

See development page for details

Old version

See https://github.com/kotlinx/kotlinx.html.legacy for older version. We strongly recommend to migrate to latest version.

compile "org.jetbrains.kotlinx:kotlinx-html:0.6.4"

Related Libraries

chrome-reactive-kotlin

Headless Chrome DevTools Protocol Client (RxJava2 + Kotlin)

Last updated 3 mins ago

vertx-lang-kotlin

Kotlin lang for Vert.x 3

Last updated 3 mins ago

kara

Kotlin Web Framework for the JVM

Last updated 3 mins ago

kraph

GraphQL request string builder written in Kotlin

Last updated 3 mins ago

tekniq

A framework designed around Kotlin providing a full-featured HTTP Framework, Restful HTTP Client, JDBC DSL, Loading Cache, Configurations, and more

Last updated 3 mins ago