Skip to content

Input OTP

Accessible one-time password component with copy paste support.

Examples

Default

vue
<script setup>
import { ref } from 'vue'
import {
  InputOTP,
  InputOTPGroup,
  InputOTPSeparator,
  InputOTPSlot,
} from '@empathyds/vue'

const value = ref('')
</script>

<template>
  <InputOTP v-model="value" :maxlength="6">
    <InputOTPGroup>
      <InputOTPSlot :index="0" />
      <InputOTPSlot :index="1" />
      <InputOTPSlot :index="2" />
    </InputOTPGroup>
    <InputOTPSeparator />
    <InputOTPGroup>
      <InputOTPSlot :index="3" />
      <InputOTPSlot :index="4" />
      <InputOTPSlot :index="5" />
    </InputOTPGroup>
  </InputOTP>
</template>

Props

InputOTP

PropTypeDefaultDescription
maxlengthnumber6The number of characters in the OTP.
containerClassstring-The class for the container element.
inputModestringnumericThe input mode for the input element.

Slots

InputOTP

SlotDescription
defaultThe content of the input OTP.

InputOTPGroup

SlotDescription
defaultThe content of the group.

InputOTPSlot

SlotDescription
defaultThe content of the slot.