Skip to content

Auto focus

Applies automatic focus to an element.

Import

ts
import vAutofocus from '@leaflink/stash/directives/autofocus';

Basic usage

template
<Input label="First Name" v-model="firstName" v-autofocus />

Empty value

If the empty modifier exists, only focus if the value is empty.

template
<Input label="Last Name" v-model="lastName" v-autofocus.empty />