Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
org.jetbrains.kotlinx:kotlinx-html-jvm
Advanced tools
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.
The kotlinx.html library provides a DSL to build HTML to Writer/Appendable or DOM. Available to all Kotlin Multiplatform targets and browsers (or other WasmJS or JavaScript engines) for better Kotlin programming for Web.
See Getting started page for details how to include the library.
You can build a DOM tree with JVM, JS, and WASM. The following example shows how to build the DOM for WasmJs-targeted Kotlin:
import kotlinx.browser.document
import kotlinx.browser.window
import kotlinx.html.a
import kotlinx.html.div
import kotlinx.html.dom.append
import kotlinx.html.dom.create
import kotlinx.html.p
fun main() {
val body = document.body ?: error("No body")
body.append {
div {
p {
+"Here is "
a("https://kotlinlang.org") { +"official Kotlin site" }
}
}
}
val timeP = document.create.p {
+"Time: 0"
}
body.append(timeP)
var time = 0
window.setInterval({
time++
timeP.textContent = "Time: $time"
return@setInterval null
}, 1000)
}
You can build HTML directly to Writer (JVM) or Appendable (Multiplatform)
System.out.appendHTML().html {
body {
div {
a("https://kotlinlang.org") {
target = ATarget.blank
+"Main site"
}
}
}
}
See wiki pages
See development page for details.
FAQs
Unknown package
We found that org.jetbrains.kotlinx:kotlinx-html-jvm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.