checkbox

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

This component generates a single checkbox. So this component supports the use case to select or deselect an option. If an application has a strong focus on mobile, consider a switch instead!

Example usage

val cheeseStore = storeOf(false)
checkbox(value = cheeseStore) {
label("with extra cheese") // set the label
}

See also

Parameters

styling

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

value

a boolean store to handle the state and its changes automatically

baseClass

optional CSS class that should be applied to the element

id

the ID of the element

prefix

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

build

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