Kotlin DSL for HTML
Kotlin Shell Batchfile JavaScript
Switch branches/tags
v0.3.2 v0.3.1 v0.3.0 v0.2-alpha kotlinx.html-0.5.12 kotlinx.html-0.5.11 kotlinx.html-0.5.10 kotlinx.html-0.5.9 kotlinx.html-0.5.8 kotlinx.html-0.5.7 kotlinx.html-0.5.6 kotlinx.html-0.5.5 kotlinx.html-0.5.4 kotlinx.html-0.5.3 kotlinx.html-0.5.2 kotlinx.html-0.5.1 kotlinx.html-0.5.0 kotlinx.html-0.4.49 kotlinx.html-0.4.48 kotlinx.html-0.4.47 kotlinx.html-0.4.46 kotlinx.html-0.4.45 kotlinx.html-0.4.44 kotlinx.html-0.4.43 kotlinx.html-0.4.42 kotlinx.html-0.4.41 kotlinx.html-0.4.40 kotlinx.html-0.4.39 kotlinx.html-0.4.38 kotlinx.html-0.4.37 kotlinx.html-0.4.36 kotlinx.html-0.4.35 kotlinx.html-0.4.34 kotlinx.html-0.4.33 kotlinx.html-0.4.32 kotlinx.html-0.4.31 kotlinx.html-0.4.30 kotlinx.html-0.4.29 kotlinx.html-0.4.28 kotlinx.html-0.4.27 kotlinx.html-0.4.26 kotlinx.html-0.4.25 kotlinx.html-0.4.24 kotlinx.html-0.4.23 kotlinx.html-0.4.22 kotlinx.html-0.4.21 kotlinx.html-0.4.20 kotlinx.html-0.4.19 kotlinx.html-0.4.18 kotlinx.html-0.4.17 kotlinx.html-0.4.16 kotlinx.html-0.4.15 kotlinx.html-0.4.14 kotlinx.html-0.4.13 kotlinx.html-0.4.12 kotlinx.html-0.4.11 kotlinx.html-0.4.10 kotlinx.html-0.4.9 kotlinx.html-0.4.8 kotlinx.html-0.4.7 kotlinx.html-0.4.6 kotlinx.html-0.4.5 kotlinx.html-0.4.0 kotlinx.html-0.3.13 kotlinx.html-0.3.12 kotlinx.html-0.3.11 kotlinx.html-0.3.10 kotlinx.html-0.3.9 kotlinx.html-0.3.8 kotlinx.html-0.3.7 kotlinx.html-0.3.6 kotlinx.html-0.3.5 kotlinx.html-0.3.4 kotlinx.html-0.3.3 kotlinx-html-0.6.3 kotlinx-html-0.6.2 kotlinx-html-0.6.1 0.2.2 0.2.1 0.2.0
Nothing to show
Latest commit 978791b May 13, 2017 @yole yole committed on GitHub Add missing LICENSE file

README.md

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.