Skip to content

Function: useKeyPress ​

â–¸ useKeyPress(keyFilter, options?): Ref<boolean>

Composable that returns a boolean value if a key is pressed

Parameters ​

NameTypeDescription
keyFilterMaybeRefOrGetter<null | KeyFilter>Can be a boolean, a string, an array of strings or a function that returns a boolean. If it's a boolean, it will act as if the key is always pressed. If it's a string, it will return true if a key matching that string is pressed. If it's an array of strings, it will return true if any of the strings match a key being pressed, or a combination (e.g. ['ctrl+a', 'ctrl+b'])
options?UseKeyPressOptionsOptions object

Returns ​

Ref<boolean>

Released under the MIT License.