Checkbox

fun Checkbox(state: ToggleableState, onClick: () -> Unit?, modifier: Modifier = Modifier, enabled: Boolean = true, intent: ToggleIntent = ToggleIntent.Basic, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

Checkboxes allows users to select one or more items from a set. Checkboxes can turn an option on or off.

  • Toggle a single item on or off.

  • Require another action to activate or deactivate something.

Parameters

state

whether TriStateCheckbox is checked, unchecked or in indeterminate state

onClick

callback to be invoked when checkbox is being clicked, therefore the change of checked state in requested. If null, then this is passive and relies entirely on a higher-level component to control the "checked" state.

modifier

Modifier to be applied to the layout of the checkbox

enabled

whether the component is enabled or grayed out

intent

The ToggleIntent to use to draw the checkbox

interactionSource

the MutableInteractionSource representing the stream of Interactions for this Checkbox. You can create and pass in your own remembered MutableInteractionSource if you want to observe Interactions and customize the appearance / behavior of this Checkbox in different Interactions.

See also

if you require support for an indeterminate state, or more advanced color customization between states. Be aware that this is still an internal composable so if you need such state contact the Spark team.