OudsCheckboxItem

fun OudsCheckboxItem(checked: Boolean, label: String, onCheckedChange: (Boolean) -> Unit?, modifier: Modifier = Modifier, description: String? = null, icon: OudsControlItemIcon? = null, edgeToEdge: Boolean = true, divider: Boolean = false, reversed: Boolean = false, enabled: Boolean = true, readOnly: Boolean = false, error: OudsError? = null, constrainedMaxWidth: Boolean = false, interactionSource: MutableInteractionSource? = null)

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

The checkbox item variant can function as a simple input with a label, or it can be combined with optional elements such as description, a divider, or an icon, allowing it to suit various use cases.

The OUDS checkbox item layout contains an OudsCheckbox. By clicking on a checkbox item, the user changes the checked state of its checkbox.

Design

Guidelinesunified-design-system.orange.com
Version2.4.0

Parameters

checked

Controls the checked state of the item's checkbox.

label

The main label of the checkbox item.

onCheckedChange

Callback invoked on checkbox item 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 item.

description

Optional text displayed below the label.

icon

Optional icon displayed in the item. By default, it has a trailing position. If reversed is set to true, it is displayed as a leading element.

edgeToEdge

Controls the horizontal layout of the item. When true, the item is designed to span the full width of the screen or container. When false, it is adapted for use within constrained layouts or containers with their own padding. Defaults to true.

divider

Controls the display of a divider at the bottom of the checkbox item.

reversed

When false, the checkbox has a leading position and the optional icon has a trailing position. Otherwise, it is reversed.

enabled

Controls the enabled state of the checkbox item. When false, the checkbox, the texts and the optional icon are disabled, and the item will not be clickable.

readOnly

Controls the read-only state of the checkbox item. When true the item's checkbox is disabled but the texts and the icon remain in enabled color. Note that if it is set to true and enabled is set to false, the checkbox item will be displayed in disabled state.

error

Optional OudsError to indicate that the checkbox item should appear in error state, null otherwise.

constrainedMaxWidth

When true, the item width is constrained to a maximum value defined by the design system. When false, no specific width constraint is applied, allowing the component to size itself or follow external modifiers. Defaults to false.

interactionSource

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

See also

If you need an indeterminate state for the item's checkbox.

If you want to use a standalone checkbox without any other element.

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 androidx.compose.ui.tooling.preview.PreviewLightDark
import com.orange.ouds.core.component.OudsCheckboxItem
import com.orange.ouds.core.component.OudsTriStateCheckboxItem
import com.orange.ouds.core.utilities.OudsPreview

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

OudsCheckboxItem(
    checked = checked,
    label = "Terms of use",
    description = "By checking this box, I acknowledge having read the conditions of use.",
    onCheckedChange = { value -> checked = value },
    divider = false
) 
   //sampleEnd
}