Skip to content

onStartTyping

Category
Export Size
825 B
Last Changed
6 months ago

Fires when users start typing on non-editable elements.

Demo

Usage

vue
<script setup lang="ts">
import { 
onStartTyping
} from '@vueuse/core'
import {
useTemplateRef
} from 'vue'
const
input
=
useTemplateRef
('input')
onStartTyping
(() => {
if (!
input
.
value
.active)
input
.
value
.
focus
()
}) </script> <template> <
input
ref
="
input
"
type
="text"
placeholder
="Start typing to focus">
</template>

Type Declarations

ts
/**
 * 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
Anthony Fu
SerKo
Bernard Borg
meenie-net
丶远方
Alex Kozack
Nurettin Kaya
Antério Vieira
Seifeldin Mahjoub

Changelog

v12.8.0 on
58a3b - fix: Incorrect accepted valid characters (#4616)
v10.7.0 on
fccf2 - feat: upgrade deps (#3614)
v10.0.0-beta.3 on
e9ab3 - fix: fix char ascii (#2932)

Released under the MIT License.

FREE WEEKEND
48 Hours of Unlimited Official Vue.js Certification Training
Reserve Your Spot
23-24 August