Property

isShiftPressed

Indicates whether the Shift key is pressed.

KeyEventIsShiftPressedSample

@Sampled
@Composable
fun KeyEventIsShiftPressedSample() {
    Box(
        Modifier.onKeyEvent {
                if (it.isShiftPressed && it.key == Key.A) {
                    println("Shift + A is pressed")
                    true
                } else {
                    false
                }
            }
            .focusable()
    )
}
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: