Checkbox

Checkbox

A three state checkbox component.


Installation

./gradlew lumo --add Checkbox

Usage

Basic Checkbox

var isChecked by remember { mutableStateOf(false) }
 
Checkbox(
    checked = isChecked,
    onCheckedChange = { isChecked = it }
)

Tri-State Checkbox

var triState by remember { mutableStateOf(ToggleableState.Off) }
 
TriStateCheckbox(
    state = triState,
    onClick = {
        triState = when (triState) {
            ToggleableState.Off -> ToggleableState.Indeterminate
            ToggleableState.Indeterminate -> ToggleableState.On
            ToggleableState.On -> ToggleableState.Off
        }
    }
)

API Documentation

Checkbox Types

ComponentDescription
CheckboxStandard two-state checkbox (checked/unchecked)
TriStateCheckboxThree-state checkbox (checked/unchecked/indeterminate)

Parameters

ParameterTypeDescription
checkedBooleanCurrent checked state
onCheckedChange((Boolean) -> Unit)?Callback when checkbox state changes
modifierModifierModifier for the checkbox
enabledBooleanWhether the checkbox is enabled
colorsCheckboxColorsColors for different checkbox states
interactionSourceMutableInteractionSourceSource of interactions for the checkbox