Files
heroui-vue/apps/docs/demos/input-otp-custom-styles.vue
T

37 lines
1.1 KiB
Vue

<script setup lang="ts">
import {
InputOTP,
InputOTPGroup,
InputOTPSeparator,
InputOTPSlot,
Label,
Link,
} from "@heroui-vue/components";
const slotClass =
"rounded-lg border-border/80 bg-default data-[active=true]:border-accent/40 data-[active=true]:bg-accent-soft";
import { useId } from "vue";
const otpLabelId = useId();
</script>
<template>
<div class="flex w-72 flex-col gap-2">
<Label :id="otpLabelId">验证账户</Label>
<InputOTP :aria-labelledby="otpLabelId" :max-length="6">
<InputOTPGroup>
<InputOTPSlot :class="slotClass" :index="0" />
<InputOTPSlot :class="slotClass" :index="1" />
<InputOTPSlot :class="slotClass" :index="2" />
</InputOTPGroup>
<InputOTPSeparator class="bg-border" />
<InputOTPGroup>
<InputOTPSlot :class="slotClass" :index="3" />
<InputOTPSlot :class="slotClass" :index="4" />
<InputOTPSlot :class="slotClass" :index="5" />
</InputOTPGroup>
</InputOTP>
<Link class="text-sm text-link" href="#">重新发送</Link>
</div>
</template>