useKeyStatus

Tags:

A React Hook that helps to track the press status of a key.

Demo

Try to press -/= to check the status of the key.

Source
-
=
r
e
a
c
t
U
S
E

Usage

See API for more details.

Source

Click links below to view source on GitHub.

API

const isPressed = useKeyStatus(keyFilter, handler, options)

KeyFilter

See KeyFilter of useKeyStroke for more details.

Handler

export type UseKeyStatusHandler = UseKeyStrokeHandler;

See Handler of useKeyStroke for more details.

Options

export type UseKeyStatusOptions = Omit<UseKeyStrokeOptions, 'eventName' | 'dedupe'>;

See Options of useKeyStroke for more details.

Returns

A boolean value that indicates the press status of the key.