input-otp

OTP input with multiple separators.

OTP input with multiple separators.

Загрузка превью…

src/input-otp/c-input-otp-3.vue

<script setup lang="ts">
import { ref } from "vue"
import { Field, FieldLabel } from "@/components/ui/field"
import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot } from "@/components/ui/input-otp"

const value = ref(["1", "2", "3", "4", "5", "6"])
</script>

<template>
  <div class="flex items-center justify-center">
    <Field>
      <FieldLabel for="multi-separator">Multi-Separator</FieldLabel>
      <InputOTP id="multi-separator" v-model="value">
        <InputOTPGroup>
          <InputOTPSlot :index="0" />
          <InputOTPSlot :index="1" />
        </InputOTPGroup>
        <InputOTPSeparator />
        <InputOTPGroup>
          <InputOTPSlot :index="2" />
          <InputOTPSlot :index="3" />
        </InputOTPGroup>
        <InputOTPSeparator />
        <InputOTPGroup>
          <InputOTPSlot :index="4" />
          <InputOTPSlot :index="5" />
        </InputOTPGroup>
      </InputOTP>
    </Field>
  </div>
</template>

Установка

npx shadcn-vue@latest add https://revueui.rootapi.dev/r/c-input-otp-3.json

Зависимости реестра

Источник: порт из ReUI (Keenthemes, MIT)