Compose Modifier

focusProperties

This modifier allows you to specify properties that are accessible to focusTargets further down the modifier chain or on child layout nodes.

FocusPropertiesSample

@Sampled
@Composable
fun FocusPropertiesSample() {
    Column {
        // Always focusable.
        Box(modifier = Modifier.focusProperties { canFocus = true }.focusTarget())
        // Only focusable in non-touch mode.
        val inputModeManager = LocalInputModeManager.current
        Box(
            modifier =
                Modifier.focusProperties { canFocus = inputModeManager.inputMode != Touch }
                    .focusTarget()
        )
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: