# Interface KeyboardEvent<T>

currentTarget - a reference to the element on which the event listener is registered.

target - a reference to the element from which the event was originally dispatched. This might be a child element to the element on which the event listener is registered. If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682

interface KeyboardEvent<T> {
altKey: boolean;
bubbles: boolean;
cancelable: boolean;
charCode: number;
code: string;
ctrlKey: boolean;
currentTarget: EventTarget & T;
defaultPrevented: boolean;
detail: number;
eventPhase: number;
isTrusted: boolean;
key: string;
keyCode: number;
locale: string;
location: number;
metaKey: boolean;
nativeEvent: KeyboardEvent;
repeat: boolean;
shiftKey: boolean;
target: EventTarget;
timeStamp: number;
type: string;
view: AbstractView;
which: number;
getModifierState(key): boolean;
isDefaultPrevented(): boolean;
isPropagationStopped(): boolean;
persist(): void;
preventDefault(): void;
stopPropagation(): void;
}

#### Type Parameters

- T = Element

#### Hierarchy (view full)

- UIEvent<T, NativeKeyboardEvent>
  - KeyboardEvent

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2255

#####
Index

### Properties

altKey
bubbles
cancelable
charCode
code
ctrlKey
currentTarget
defaultPrevented
detail
eventPhase
isTrusted
key
keyCode
locale
location
metaKey
nativeEvent
repeat
shiftKey
target
timeStamp
type
view
which

### Methods

getModifierState
isDefaultPrevented
isPropagationStopped
persist
preventDefault
stopPropagation

## Properties

### altKey

altKey: boolean

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2256

### bubbles

bubbles: boolean

Inherited from UIEvent.bubbles

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2175

### cancelable

cancelable: boolean

Inherited from UIEvent.cancelable

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2176

### charCode

charCode: number

#### Deprecated

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2258

### code

code: string

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2260

### ctrlKey

ctrlKey: boolean

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2259

### currentTarget

currentTarget: EventTarget & T

Inherited from UIEvent.currentTarget

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2173

### defaultPrevented

defaultPrevented: boolean

Inherited from UIEvent.defaultPrevented

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2177

### detail

detail: number

Inherited from UIEvent.detail

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2317

### eventPhase

eventPhase: number

Inherited from UIEvent.eventPhase

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2178

### isTrusted

isTrusted: boolean

Inherited from UIEvent.isTrusted

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2179

### key

key: string

See the DOM Level 3 Events spec. for possible values

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2268

### keyCode

keyCode: number

#### Deprecated

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2270

### locale

locale: string

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2271

### location

location: number

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2272

### metaKey

metaKey: boolean

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2273

### nativeEvent

nativeEvent: KeyboardEvent

Inherited from UIEvent.nativeEvent

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2172

### repeat

repeat: boolean

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2274

### shiftKey

shiftKey: boolean

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2275

### target

target: EventTarget

Inherited from UIEvent.target

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2174

### timeStamp

timeStamp: number

Inherited from UIEvent.timeStamp

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2185

### type

type: string

Inherited from UIEvent.type

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2186

### view

view: AbstractView

Inherited from UIEvent.view

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2318

### which

which: number

#### Deprecated

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2277

## Methods

### getModifierState

- getModifierState(key): boolean

- See DOM Level 3 Events spec. for a list of valid (case-sensitive) arguments to this method.

  #### Parameters

  - key: ModifierKey

  #### Returns boolean

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2264

### isDefaultPrevented

- isDefaultPrevented(): boolean

- #### Returns boolean

  Inherited from UIEvent.isDefaultPrevented

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2181

### isPropagationStopped

- isPropagationStopped(): boolean

- #### Returns boolean

  Inherited from UIEvent.isPropagationStopped

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2183

### persist

- persist(): void

- #### Returns void

  Inherited from UIEvent.persist

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2184

### preventDefault

- preventDefault(): void

- #### Returns void

  Inherited from UIEvent.preventDefault

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2180

### stopPropagation

- stopPropagation(): void

- #### Returns void

  Inherited from UIEvent.stopPropagation

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2182