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
- Kotlin
- Dart
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
- Kotlin
- Dart
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,
)
| Name | Type | Default |
|---|---|---|
checked | Boolean | required |
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 |
Design notes
Why CamoCheckbox works this way, its states and its edge cases: contributor docs.