🌈 Create new beautiful Compose Gradients with our new wesite ->
Compose Modifier

minimumInteractiveComponentSize

Reserves at least 48.dp in size to disambiguate touch interactions if the element would measure smaller.

MinimumInteractiveComponentSizeSample

@Preview
@Sampled
@Composable
fun MinimumInteractiveComponentSizeSample() {

MinimumInteractiveComponentSizeCheckboxRowSample

@Preview
@Sampled
@Composable
fun MinimumInteractiveComponentSizeCheckboxRowSample() {
    var checked by remember { mutableStateOf(false) }

    // The entire row accepts interactions to toggle the checkbox,
    // so we apply `minimumInteractiveComponentSize`
    Row(
        verticalAlignment = Alignment.CenterVertically,
        modifier =
            Modifier.toggleable(
                    value = checked,
                    onValueChange = { checked = it },
                    role = Role.Checkbox,
                )
                .minimumInteractiveComponentSize(),
    ) {
        // Cannot rely on Checkbox for touch target expansion because it only enforces
        // `minimumInteractiveComponentSize` if onCheckedChange is non-null
        Checkbox(checked = checked, onCheckedChange = null)
        Spacer(Modifier.width(8.dp))
        Text("Label for checkbox")
    }
}

Content updated: