> For the complete documentation index, see [llms.txt](/llms.txt).
> The full corpus is at [llms-full.txt](/llms-full.txt).

# KeyboardEventDefinition

> **KeyboardEventDefinition** = \{ `code`: `KeyboardEvent`\[`"code"`\]; `key`: `KeyboardEvent`\[`"key"`\]; \} \| \{ `code?`: `undefined`; `key`: `KeyboardEvent`\[`"key"`\]; \} \| \{ `code`: `KeyboardEvent`\[`"code"`\]; `key?`: `undefined`; \} & `object`

Defined in: keyboard-event-definition.ts:25

A keyboard event definition that can be used to create a keyboard shortcut.

At least one of `key` or `code` must be provided while the `alt`, `ctrl`,
`meta`, and `shift` modifier configurations are optional.

The `key` represents a https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
and is treated as case-insensitive.

The `code` represents a https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
and is treated as case-insensitive.

## Type Declaration

### alt?

> `optional` **alt**: `KeyboardEvent`\[`"altKey"`\]

### ctrl?

> `optional` **ctrl**: `KeyboardEvent`\[`"ctrlKey"`\]

### meta?

> `optional` **meta**: `KeyboardEvent`\[`"metaKey"`\]

### shift?

> `optional` **shift**: `KeyboardEvent`\[`"shiftKey"`\]

## Example

```typescript
const boldEvent: KeyboardEventDefinition = {
  key: 'B',
  alt: false,
  ctrl: true,
  meta: false,
  shift: false,
}
```