Input OTP
A segmented OTP / verification code input.
input-otp-demo.app
Installation
terminal.sh
npx y2kui@latest add input-otpUsage
import {
InputOTP,
InputOTPGroup,
InputOTPSlot,
InputOTPSeparator,
} from "@/components/ui/input-otp"
<InputOTP 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>Props
| Prop | Type | Default | Description |
|---|---|---|---|
maxLength | number | 6 | Number of digit slots. |
value | string | — | Controlled value. |
onChange | (value: string) => void | — | Called when value changes. |
disabled | boolean | false | Disables the input. |
InputOTPSlot | { index: number } | — | Individual character slot. |