checkbox

fun RenderContext.checkbox(styling: BasicParams.() -> Unit = {}, baseClass: StyleClass? = null, id: String? = null, prefix: String = "checkboxComponent", build: CheckboxComponent.() -> Unit = {}): Label

This component generates a single checkbox.

You can set different kind of properties like the labeltext or different styling aspects like the colors of the background, the label or the checked state. Further more there are configuration functions for accessing the checked state of this box or totally disable it. For a detailed overview about the possible properties of the component object itself, have a look at CheckboxComponent

Example usage

checkbox {
label("with extra cheese") // set the label
size { normal } // choose a predefined size
checked { cheeseStore.data } // link a [Flow<Boolean>] in order to visualize the checked state
events { // open inner context with all DOM-element events
changes.states() handledBy cheeseStore.update // connect the changes event with the state store
}
}

See also

Parameters

baseClass

optional CSS class that should be applied to the element

build

a lambda expression for setting up the component itself. Details in CheckboxComponent

id

the ID of the element

prefix

the prefix for the generated CSS class resulting in the form `$prefix-$hash`

styling

a lambda expression for declaring the styling as fritz2's styling DSL