CheckboxLabel

fun CheckboxLabel(state: ToggleableState, onClick: () -> Unit, modifier: Modifier = Modifier, leftImage: Painter? = null, text: String = "", rightImage: Painter? = null, isEnabled: Boolean = true, labelState: LabelState = LabelState.Default, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

A checkbox is a component that allows users to select one or multiple options from a set.

This version of the Checkbox has a label, and optional images on the left and right side of the label.

Checkbox with Label Sample

States

The checkbox with label can be in different states that can be toggled with the isEnabled and labelState parameters.

Disabled

Disabled Checkbox with Label Sample

Error

Error Checkbox with Label Sample

Parameters

state

The ToggleableState of the checkbox.

onClick

The Lambda to be invoked when the checkbox is clicked.

modifier

An optional Modifier to be applied to the checkbox. Defaults to Modifier.

leftImage

An optional Painter to be displayed on the left of the checkbox. Defaults to null.

text

The text to be displayed as the label of the checkbox. Defaults to an empty string.

rightImage

An optional Painter to be displayed on the right of the checkbox. Defaults to null.

isEnabled

Whether the checkbox is enabled or not. Defaults to true.

labelState

The LabelState of the label. Defaults to LabelState.Default.

interactionSource

An optional hoisted MutableInteractionSource for observing and emitting Interactions for the checkbox. You can use this to change the checkbox's appearance or preview the checkbox in different states. Defaults to a remembered MutableInteractionSource.