Platform-agnostic CSS primitives.
To use kotlin-css
in the browser, install kotlin-css
and kotlin-css-js
using npm or Yarn:
-
npm i @jetbrains/kotlin-css @jetbrains/kotlin-css-js
-
npm run gen-idea-libs
To use kotlin-css
on the server, install kotlin-css
and kotlin-css-jvm
using Maven or Gradle.
See the Bintray page for Maven and Gradle installation instructions.
kotlin-css
is a DSL for authoring stylesheets in Kotlin. The DSL supports most common CSS properties and values,
including animations, transforms, shadows, and flexbox. SVG properties as well as CSS grids are not supported yet,
contributions are welcome.
kotlin-css
is a low-level library. After constructing a stylesheet you can serialize it into a string and do with it
as you please:
val styles = CSSBuilder().apply {
body {
margin = 0.px
padding = 0.px
}
}
styles.toString()
When writing CSS for the browser you should probably use
kotlin-styled instead. It provides a
user-friendly facade to kotlin-css
.