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
Component | Description |
---|---|
Checkbox | Standard two-state checkbox (checked/unchecked) |
TriStateCheckbox | Three-state checkbox (checked/unchecked/indeterminate) |
Parameters
Parameter | Type | Description |
---|---|---|
checked | Boolean | Current checked state |
onCheckedChange | ((Boolean) -> Unit)? | Callback when checkbox state changes |
modifier | Modifier | Modifier for the checkbox |
enabled | Boolean | Whether the checkbox is enabled |
colors | CheckboxColors | Colors for different checkbox states |
interactionSource | MutableInteractionSource | Source of interactions for the checkbox |