Element focus change - Jetpack Compose

In Jetpack Compose, you can use the onFocusChanged modifier to listen for focus changes. It contains a property such, as isFocused, to check if composable currently has focus.

Button(
    onClick = { /* Your click handling */ },
    modifier = Modifier
        .onFocusChanged {
            if (it.isFocused) {
                // logic in case view is focused
            }
        }
) {
    // Button content ...
}