Skip to main content
Vuetify0 is now in alpha!
Vuetify0 Logo
Theme
Mode
Palettes
Accessibility
Vuetify One
Sign in to Vuetify One

Access premium tools across the Vuetify ecosystem — Bin, Play, Studio, and more.

Not a subscriber? See what's included

useHotkey API

API reference for the useHotkey composable.

Explore these related pages for additional context and usage patterns.

PageCategory
useHotkeySystem
useEventListenerSystem
useClickOutsideSystem

Functions

useHotkey

(keys: MaybeRefOrGetter<string | undefined>, callback: (e: KeyboardEvent) => void, options?: UseHotkeyOptions, _platform?: PlatformContext | undefined) => UseHotkeyReturn

A composable that listens for hotkey combinations and sequences.

Options

event

MaybeRefOrGetter<"keydown" | "keyup"> | undefined

The keyboard event type to listen for.

Default: 'keydown'

inputs

MaybeRefOrGetter<boolean> | undefined

Whether to trigger the callback when an input element is focused.

Default: false

preventDefault

MaybeRefOrGetter<boolean> | undefined

Whether to prevent the default browser action.

Default: true

stopPropagation

MaybeRefOrGetter<boolean> | undefined

Whether to stop event propagation.

Default: false

sequenceTimeout

MaybeRefOrGetter<number> | undefined

Timeout in ms before a key sequence resets.

Default: 1000

Properties

isActive

Readonly<Ref<boolean, boolean>>

Whether the hotkey listener is currently active (listening for keys). False when paused, when keys is undefined, or in SSR.

isPaused

Readonly<Ref<boolean, boolean>>

Whether the hotkey listener is currently paused.

Methods

pause

() => void

Pause listening (removes listener but keeps configuration).

resume

() => void

Resume listening after pause.

stop

() => void

Stop listening and clean up (removes listener).

Was this page helpful?

© 2016-1970 Vuetify, LLC
Ctrl+/