OudsTriStateCheckbox
OUDS Checkbox design guidelines
An OUDS checkbox parent. Checkboxes can have a parent-child relationship with other checkboxes. When the parent checkbox is checked, all child checkboxes are checked. If a parent checkbox is unchecked, all child checkboxes are unchecked. If some, but not all, child checkboxes are checked, the parent checkbox becomes an indeterminate checkbox.
Parameters
Controls whether TriStateCheckbox is checked, unchecked or in indeterminate state.
Callback invoked when checkbox is being clicked, therefore the change of ToggleableState state is requested. If null, then this is passive and relies entirely on a higher-level component to control the state.
Modifier applied to the layout of the checkbox.
Controls the enabled state of the checkbox. When false
, this checkbox will not be clickable.
Controls the error state of the checkbox.
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 toggleableState by remember { mutableStateOf(ToggleableState.Off) }
OudsTriStateCheckbox(
state = toggleableState,
onClick = {
toggleableState = when (toggleableState) {
ToggleableState.On -> ToggleableState.Off
ToggleableState.Off -> ToggleableState.Indeterminate
ToggleableState.Indeterminate -> ToggleableState.On
}
}
)
//sampleEnd
}