keydown event

The browser event fired when a key is pressed, whose key property names the key, such as "Escape" or "ArrowDown".

In more detail

A useKeyPress hook listens for keydown on window and runs a callback when event.key matches. Keyboard navigation in menus and tabs also relies on it.

Example

A useKeyPress hook listens for keydown on window and runs a callback when event.key matches.

Related terms

Taught in

References