---
title: "isAltPressed"
description: "Indicates whether the Alt key is pressed."
type: "property"
---

<div class='type'>Property</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
expect val KeyEvent.isAltPressed: Boolean
```


Indicates whether the Alt key is pressed.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
expect val PointerKeyboardModifiers.isAltPressed: Boolean
```


`true` when the Alt key is pressed. This is commonly associated with the Option key on some
keyboards.



<div class='sourceset sourceset-android'>Android</div>


```kotlin
actual val KeyEvent.isAltPressed: Boolean
```


Indicates whether the Alt key is pressed.



<div class='sourceset sourceset-android'>Android</div>


```kotlin
actual val PointerKeyboardModifiers.isAltPressed: Boolean
```


## Code Examples

### KeyEventIsAltPressedSample
```kotlin
@Composable
fun KeyEventIsAltPressedSample() {
    Box(
        Modifier.onKeyEvent {
                if (it.isAltPressed && it.key == Key.A) {
                    println("Alt + A is pressed")
                    true
                } else {
                    false
                }
            }
            .focusable()
    )
}
```

