Skip to content
On this page

onStartTyping

Category
Export Size
1.24 kB
Last Changed
last year

Fires when users start typing on non-editable elements.

Demo

Type anything

Usage

html
<input ref="input" type="text" placeholder="Start typing to focus" />
<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,
    }
  },
}
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
/**
 * 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

Released under the MIT License.