State of Compose 2023 results are in! Click here to learn more

← Back to Wear Material 3

Checkbox

Component
in
Wear Material 3
. Since 1.0.0-alpha08

Overview

Code Examples

Video

Checkbox provides an animated checkbox for use as a selection control in ToggleButton or SplitToggleButton.

Checkbox sample:

Overloads

Checkbox

@Composable
fun Checkbox(
    checked: Boolean,
    modifier: Modifier = Modifier,
    colors: CheckboxColors = CheckboxDefaults.colors(),
    enabled: Boolean = true,
    onCheckedChange: ((Boolean) -> Unit)? = null,
    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
)

Parameters

NameDescription
checkedBoolean flag indicating whether this checkbox is currently checked.
modifierModifier to be applied to the checkbox. This can be used to provide a content description for accessibility.
colorsCheckboxColors from which the box and checkmark colors will be obtained.
enabledBoolean flag indicating the enabled state of the Checkbox (affects the color).
onCheckedChangeCallback 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 ToggleButton or SplitToggleButton).
interactionSourceWhen also providing onCheckedChange, the MutableInteractionSource representing the stream of Interactions for the "toggleable" tap area - can be used to customise the appearance / behavior of the Checkbox