Checkbox

fun Checkbox(checked: Boolean, label: String, onClick: () -> Unit?, modifier: Modifier = Modifier, interactiveState: SelectableInteractiveState = SelectableInteractiveState.Default, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

Carbon Checkbox

Checkboxes are used when there are multiple items to select in a list. Users can select zero, one, or any number of items.

Content

  • The checkbox itself is a square box with a checkmark or an indeterminate mark.

  • The label describes the information the user wants to select or unselect.

  • The error or warning message are displayed below the checkbox and help the user understand about a certain state regarding the checkbox context.

(From Checkbox documentation)

Parameters

checked

Whether the checkbox is checked.

label

The text to be displayed next to the checkbox.

onClick

Callback invoked when the checkbox is clicked.

modifier

The modifier to be applied to the checkbox.

interactiveState

The SelectableInteractiveState of the checkbox.

interactionSource

The MutableInteractionSource that keeps track of the checkbox state.


fun Checkbox(state: ToggleableState, label: String, onClick: () -> Unit?, modifier: Modifier = Modifier, interactiveState: SelectableInteractiveState = SelectableInteractiveState.Default, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

Carbon Checkbox

Checkboxes are used when there are multiple items to select in a list. Users can select zero, one, or any number of items.

Content

  • The checkbox itself is a square box with a checkmark or an indeterminate mark.

  • The label describes the information the user wants to select or unselect.

  • The error or warning message are displayed below the checkbox and help the user understand about a certain state regarding the checkbox context.

Interactions

The component applies a tri-state toggleable interaction to the checkbox root composable if the onClick callback is provided, meaning that the whole component is clickable in order to create a more accessible click target. Otherwise, the checkbox won't be interactable.

(From Checkbox documentation)

Parameters

state

The ToggleableState of the checkbox.

label

The text to be displayed next to the checkbox.

onClick

Callback invoked when the checkbox is clicked.

modifier

The modifier to be applied to the checkbox.

interactiveState

The SelectableInteractiveState of the checkbox.

interactionSource

The MutableInteractionSource that keeps track of the checkbox state.