# KeyboardState

`import { KeyboardState } from "destack:input/binding";`

Keyboard state snapshot.

```ds title="KeyboardState"
export struct KeyboardState {
    timestampNs: uint64;
    sequence: uint64;
    deviceId: string;
    hostModifiers: uint32;
    modifiers: ModifierState;
    pressedCodes: string[];
    pressedKeys: string[];
    pressedHostCodes: uint32[];
    pressedScanCodes: uint32[];
    layout: KeyboardLayout;
    isComposing: boolean;
}
```

[language/library/src/input/binding/keyboard.ds:58:81](https://github.com/destack-sh/destack/blob/main/language/library/src/input/binding/keyboard.ds#L58-L81)

## Members

### `timestampNs: uint64`

Monotonic update timestamp in nanoseconds.

### `sequence: uint64`

Monotonic sequence number generated by the host stream.

### `deviceId: string`

Stable source device identifier.

### `hostModifiers: uint32`

Host modifier bitset.

### `modifiers: ModifierState`

Keyboard modifier and lock state.

### `pressedCodes: string[]`

Normalized physical codes currently pressed.

### `pressedKeys: string[]`

Normalized logical keys currently pressed.

### `pressedHostCodes: uint32[]`

Host key codes currently pressed.

### `pressedScanCodes: uint32[]`

Host hardware scan codes currently pressed when available.

### `layout: KeyboardLayout`

Active layout when available.

### `isComposing: boolean`

Whether the keyboard is currently within one active composition session.
