OTP Input
One slot per character, like a code lock.
Install and use
The first command adds the component and the Mine theme, the second adds this example. Render <Mine> once near your root for the skin, sounds and narrator.
"use client"
import { Field, FieldLabel } from "@/components/ui/field"
import {
OTPInput,
OTPInputGroup,
OTPInputSeparator,
OTPInputSlot,
} from "@/components/ui/otp-input"
import { MinusIcon } from "lucide-react"
function Example() {
return (
<Field>
<FieldLabel>Verification code</FieldLabel>
<OTPInput maxLength={6}>
<OTPInputGroup>
<OTPInputSlot index={0} />
<OTPInputSlot index={1} />
<OTPInputSlot index={2} />
</OTPInputGroup>
<OTPInputSeparator>
<MinusIcon aria-hidden="true" />
</OTPInputSeparator>
<OTPInputGroup>
<OTPInputSlot index={3} />
<OTPInputSlot index={4} />
<OTPInputSlot index={5} />
</OTPInputGroup>
</OTPInput>
</Field>
)
}
export { Example }