TriStateCheckbox

Checkboxes can have a parent-child relationship with other checkboxes.

TriStateCheckbox preview
RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free

TriStateCheckbox

Common
@Composable
fun TriStateCheckbox(
    state: ToggleableState,
    onClick: (() -> Unit)?,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    interactionSource: MutableInteractionSource? = null,
    colors: CheckboxColors = CheckboxDefaults.colors(),
)

Parameters

state whether TriStateCheckbox is checked, unchecked or in indeterminate state
onClick callback to be 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 Modifier to be applied to the layout of the checkbox
enabled whether the component is enabled or grayed out
interactionSource an optional hoisted MutableInteractionSource for observing and emitting Interactions for this checkbox. You can use this to change the checkbox's appearance or preview the checkbox in different states. Note that if null is provided, interactions will still happen internally.
colors CheckboxColors that will be used to determine the color of the checkmark / box / border in different states. See CheckboxDefaults.colors.