OudsCheckbox

fun OudsCheckbox(checked: Boolean, onCheckedChange: (Boolean) -> Unit?, modifier: Modifier = Modifier, enabled: Boolean = true, error: Boolean = false, interactionSource: MutableInteractionSource? = null)

OUDS Checkbox design guidelines

Checkboxes are input controls that allow users to select one or more options from a number of choices.

The standalone checkbox variant is used when the checkbox input is nested within another component and an alternative label is provided. For example, a checkbox can be used in a data table where its purpose is clear from its position or its connection to other items in the same row or column.

Parameters

checked

Controls checked state of the checkbox.

onCheckedChange

Callback invoked on checkbox click. If null, then this is passive and relies entirely on a higher-level component to control the checked state.

modifier

Modifier applied to the layout of the checkbox.

enabled

Controls the enabled state of the checkbox. When false, this checkbox will not be clickable.

error

Controls the error state of the checkbox.

interactionSource

Optional hoisted MutableInteractionSource for observing and emitting Interactions for this checkbox. Note that if null is provided, interactions will still happen internally.

See also

If you require support for an indeterminate state.

If you want to use a checkbox with an associated label and other optional elements.

Samples

import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.state.ToggleableState
import com.orange.ouds.core.component.OudsCheckbox
import com.orange.ouds.core.component.OudsTriStateCheckbox

fun main() { 
   //sampleStart 
   var checked by remember { mutableStateOf(false) }

OudsCheckbox(
    checked = checked,
    onCheckedChange = { value -> checked = value }
) 
   //sampleEnd
}