aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt
index b210f2cb..aad57023 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt
@@ -31,10 +31,17 @@ import pl.treksoft.kvision.core.Widget
*
* @constructor
* @param classes a set of CSS class names
+ * @param init an initializer extension function
*/
-open class SimplePanel(classes: Set<String> = setOf()) : Widget(classes), Container {
+open class SimplePanel(classes: Set<String> = setOf(), init: (SimplePanel.() -> Unit)? = null) : Widget(classes),
+ Container {
internal val children: MutableList<Component> = mutableListOf()
+ init {
+ @Suppress("LeakingThis")
+ init?.invoke(this)
+ }
+
override fun render(): VNode {
return render("div", childrenVNodes())
}