Skip to main content

CamoCheckbox

A checkbox: selects something for later (a form that is submitted). With a label (or labelSpans, for links and bold), the whole row is one target, announced as "Remember me, checkbox, not checked". A link in the spans stays its own target. A null onCheckedChange makes it display-only, for a parent that handles clicks and semantics. error marks it invalid and shows below the row.

Usage​

var terms by remember { mutableStateOf(false) }

CamoCheckbox(
checked = terms,
onCheckedChange = { terms = it },
label = "I agree to the terms",
description = "You can change this later in Settings",
)

API​

public fun CamoCheckbox(
checked: Boolean,
onCheckedChange: ((Boolean) -> Unit)?,
modifier: Modifier = Modifier,
label: String? = null,
labelSpans: List<CamoSpan>? = null,
description: String? = null,
error: String? = null,
enabled: Boolean = true,
interactionSource: MutableInteractionSource? = null,
)
NameTypeDefault
checkedBooleanrequired
onCheckedChange((Boolean) -> Unit)?
modifierModifierModifier
labelString?null
labelSpansList<CamoSpan>?null
descriptionString?null
errorString?null
enabledBooleantrue
interactionSourceMutableInteractionSource?null
Design notes

Why CamoCheckbox works this way, its states and its edge cases: contributor docs.