Key Stroke

Listen for keyboard key being stroked.

# API

# KeyStrokeConfig

Property Description Default
key
true | string | string[] | Function
List of key(s) or predicate that trigger handler.
handler
(event: KeyboardEvent) => void
Utility function that is called when the key is being stroked.
eventName?
keydown | keypress | keyup
The specified event to listen.
keydown
target?
EventTarget
Target to attach the event listener.
document
passive?
boolean
Add event listener passive parameter.
false
preventDefault?
boolean
Whether to preventDefault before calling handler.
false
autoStop?
boolean
Whether to remove listener when hosting component is destroyed.
true