Skip to content
On this page

onStartTyping

Category
Last Changed
7 months ago

Fires when users start typing on non-editable elements.

Demo

Type anything

Usage

<input ref="input" type="text" placeholder="Start typing to focus" />
<input ref="input" type="text" placeholder="Start typing to focus" />






 
 
 
 























import { onStartTyping } from '@vueuse/core'

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

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

    return {
      input,
    }
  },
}
import { onStartTyping } from '@vueuse/core'

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

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

    return {
      input,
    }
  },
}

Type Declarations

/**
 * 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
/**
 * 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

SourceDemoDocs

Contributors

Anthony Fu
Alex Kozack
Nurettin Kaya
Antério Vieira
Seifeldin Mahjoub

Changelog

No recent changes
onStartTyping has loaded