Checkbox
Composable Component
Checkbox
provides an animated checkbox for use as a toggle control in ToggleChip
or
SplitToggleChip
.
Android
@Composable
public fun Checkbox(
checked: Boolean,
modifier: Modifier = Modifier,
colors: CheckboxColors = CheckboxDefaults.colors(),
enabled: Boolean = true,
onCheckedChange: ((Boolean) -> Unit)? = null,
interactionSource: MutableInteractionSource? = null,
): Unit
Parameters
checked | Boolean flag indicating whether this checkbox is currently checked. |
modifier | Modifier to be applied to the checkbox. This can be used to provide a content description for accessibility. |
colors | CheckboxColors from which the box and checkmark colors will be obtained. |
enabled | Boolean flag indicating the enabled state of the Checkbox (affects the color). |
onCheckedChange | Callback to be invoked when Checkbox is clicked. If null, then this is passive and relies entirely on a higher-level component to control the state (such as ToggleChip or SplitToggleChip ). |
interactionSource | When also providing onCheckedChange , an optional hoisted MutableInteractionSource for observing and emitting Interaction s for this checkbox. You can use this to change the checkbox's appearance or preview the checkbox in different states. Note that if null is provided, interactions will still happen internally. |