onStartTyping ​
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 ​
Contributors ​
Anthony Fu
Anthony Fu
meenie-net
丶远方
Alex Kozack
Nurettin Kaya
Antério Vieira
Seifeldin Mahjoub