OudsCheckbox
fun OudsCheckbox(checked: Boolean, onCheckedChange: (Boolean) -> Unit?, modifier: Modifier = Modifier, enabled: Boolean = true, error: Boolean = false, interactionSource: MutableInteractionSource? = null)
OUDS Checkbox design guidelines
An OUDS checkbox.
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.
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
}