Skip to content

onStartTyping

Category
Export Size
825 B
Last Changed
4 days 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

NoiseFan

Changelog

No recent changes

Released under the MIT License.