> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# KeyEvent

APISummary
Represents a keyboard event, inherited from [`Event`](/next/api/lynx-api/event/event.md), which describes the user's interaction with the keyboard. Each event describes a single interaction between the user and a key, or a key combined with modifier keys.

## Instance property

### key

```ts
key: string;
```

Represents the value of the physical key pressed by the user.

### repeat

```ts
repeat: boolean;
```

`true` indicates the key is being held down such that it is automatically repeating.

### altKey

```ts
altKey: boolean;
```

`true` indicates the Alt key, or Option (`⌥`) on macOS, was active when the key event was generated.

### ctrlKey

```ts
ctrlKey: boolean;
```

`true` indicates the Ctrl key was active when the key event was generated.

### metaKey

```ts
metaKey: boolean;
```

`true` indicates the Meta key was active when the key event was generated. On macOS, this is the Command (`⌘`) key. On Windows, this is the Windows key.

### shiftKey

```ts
shiftKey: boolean;
```

`true` indicates the Shift key was active when the key event was generated.

## KeyEvent type

### keydown

Indicates that a key has been pressed.

### keyup

Indicates that a key has been released.

## Compatibility

**Compatibility Table**

**Query:** `lynx-api.event.KeyEvent`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-api/event/KeyEvent.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| KeyEvent | No | No | No | Yes (3.7) | Yes (3.7) | Yes |
| key | No | No | No | Yes (3.7) | Yes (3.7) | Yes |
| repeat | No | No | No | Yes (3.7) | Yes (3.7) | No |
| altKey | No | No | No | Yes (3.7) | Yes (3.7) | Yes |
| ctrlKey | No | No | No | Yes (3.7) | Yes (3.7) | Yes |
| metaKey | No | No | No | Yes (3.7) | Yes (3.7) | Yes |
| shiftKey | No | No | No | Yes (3.7) | Yes (3.7) | Yes |
| keydown | No | No | No | Yes (3.7) | Yes (3.7) | Yes |
| keyup | No | No | No | Yes (3.7) | Yes (3.7) | Yes |

**`repeat`**

- **Web — Not supported:** The Web event bridge does not copy the browser repeat field.

