Skip to content

Latest commit

 

History

History
51 lines (38 loc) · 1.31 KB

README.md

File metadata and controls

51 lines (38 loc) · 1.31 KB

Maven Central

kotlin-css

Platform-agnostic CSS primitives.

Maven

<project>
    <dependency>
        <groupId>org.jetbrains.kotlin-wrappers</groupId>
        <artifactId>kotlin-css</artifactId>
        <version>VERSION</version>
    </dependency>
</project>

Gradle

repositories {
    mavenCentral()
}

implementation("org.jetbrains.kotlin-wrappers:kotlin-css:VERSION")

Getting Started

kotlin-css is a DSL for authoring stylesheets in Kotlin. The DSL supports most common CSS properties and values, including animations, transforms, shadows, flexbox, and grids. SVG properties 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 = Margin(0.px)
        padding = Padding(0.px)
    }
}

styles.toString()

When writing CSS for the browser you should probably use kotlin-styled-next instead. It provides a user-friendly facade to kotlin-css.