Skip to content

OTPInput

OTPInput renders a configurable set of individual digit cells for one-time password entry, with auto-advance, backspace navigation, and paste support.

Basic usage

Value: —

Tailwind v4
vue
<script setup>
import { ref } from 'vue'
const otp = ref('')
</script>

<OTPInput v-model="otp" @complete="val => console.log('Done:', val)" />

Custom length

Tailwind v4
vue
<OTPInput v-model="otp" :length="4" />

Password type

Tailwind v4
vue
<OTPInput v-model="otp" type="password" />

Disabled

Tailwind v4
vue
<OTPInput v-model="otp" :disabled="true" />

Props

PropTypeDefaultDescription
modelValuestringFull OTP string (use with v-model)
lengthnumber6Number of digit cells
disabledbooleanfalseDisables all cells
placeholderstring'·'Single character placeholder shown in empty cells
type'text' | 'password' | 'number''text'Input type for all cells

Events

EventPayloadDescription
update:modelValuestringEmitted on every change
completestringEmitted when all cells are filled

Private — Jetpack Labs internal use only