diff options
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/html/Button.kt')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/html/Button.kt | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Button.kt b/src/main/kotlin/pl/treksoft/kvision/html/Button.kt index aaa0f735..ec1d95f5 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Button.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Button.kt @@ -155,25 +155,23 @@ open class Button( } return this } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.button( - text: String, - icon: String? = null, - style: ButtonStyle = ButtonStyle.PRIMARY, - type: ButtonType = ButtonType.BUTTON, - disabled: Boolean = false, - classes: Set<String> = setOf(), - init: (Button.() -> Unit)? = null - ): Button { - val button = Button(text, icon, style, type, disabled, classes).apply { init?.invoke(this) } - this.add(button) - return button - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.button( + text: String, + icon: String? = null, + style: ButtonStyle = ButtonStyle.PRIMARY, + type: ButtonType = ButtonType.BUTTON, + disabled: Boolean = false, + classes: Set<String> = setOf(), + init: (Button.() -> Unit)? = null +): Button { + val button = Button(text, icon, style, type, disabled, classes).apply { init?.invoke(this) } + this.add(button) + return button } |