diff options
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/table/Row.kt')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/table/Row.kt | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/table/Row.kt b/src/main/kotlin/pl/treksoft/kvision/table/Row.kt new file mode 100644 index 00000000..d408f699 --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/table/Row.kt @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018. Robert Jaros + */ +package pl.treksoft.kvision.table + +import pl.treksoft.kvision.html.TAG +import pl.treksoft.kvision.html.Tag + +/** + * HTML table row component. + * + * @constructor + * @param classes a set of CSS class names + * @param init an initializer extension function + */ +open class Row(classes: Set<String> = setOf(), init: (Row.() -> Unit)? = null) : Tag( + TAG.TR, classes = classes +) { + + init { + init?.invoke(this) + } + + companion object { + /** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ + fun Table.row( + classes: Set<String> = setOf(), init: (Row.() -> Unit)? = null + ): Row { + val row = Row(classes, init) + this.add(row) + return row + } + } + +} |