Input OTP
Accessible one-time password component with copy-paste support.
Installation
npx shadcn@latest add https://reactdocs.canceydejean.dev/r/input-otp.jsonUsage
Use for verification codes and one-time passwords. Built on input-otp.
import {
InputOTP,
InputOTPGroup,
InputOTPSeparator,
InputOTPSlot,
} from "@/components/input-otp/input-otp";
export function Example() {
return (
<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>
);
}Supports controlled value / onChange, disabled, and aria-invalid for error styles.