Accessibility focus indicator - Jetpack Compose
In Jetpack Compose, you can easily create a focus indicator by using either the border
property or the border
modifier.
Another way, is by implementing a custom Indication
. You can read official documentation for more details.
var color by remember { mutableStateOf(Color.White) }
Card(
modifier = Modifier
.onFocusChanged {
// Change border color depending on focus state
color = if (it.isFocused) Color.Green else Color.White
}
.border(3.dp, color)
) {
// Card content...
}