Skip to content

onStartTyping ​

Category
Export Size
704 B
Last Changed
4 months ago

Fires when users start typing on non-editable elements.

Demo ​

Type anything

Usage ​

vue
<input ref="input" type="text" placeholder="Start typing to focus" />
ts
import { onStartTyping } from '@vueuse/core'

export default {
  setup() {
    const input = ref(null)

    onStartTyping(() => {
      if (!input.value.active)
        input.value.focus()
    })

    return {
      input,
    }
  },
}

Type Declarations ​

typescript
/**
 * Fires when users start typing on non-editable elements.
 *
 * @see https://vueuse.org/onStartTyping
 * @param callback
 * @param options
 */
export declare function onStartTyping(
  callback: (event: KeyboardEvent) => void,
  options?: ConfigurableDocument,
): void

Source ​

Source • Demo • Docs

Contributors ​

Anthony Fu
meenie-net
丶远方
Alex Kozack
Nurettin Kaya
Antério Vieira
Seifeldin Mahjoub

Changelog ​

v10.7.0 on 12/5/2023
fccf2 - feat: upgrade deps (#3614)
v10.0.0-beta.3 on 4/12/2023
e9ab3 - fix: fix char ascii (#2932)

Released under the MIT License.