InputOTP
One-time code: N boxes, auto-advance, paste fills all, onComplete when full.
Code
import * as React from 'react';
import { InputOTP } from '@fruit-labs/design';
export default function Demo() {
return <InputOTP defaultValue="482" separatorAt={3} />;
}Install
From npm:
npm install @fruit-labs/design
import { InputOTP } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/input-otp.jsonGuidelines
- 6 digits default;
separatorAt={3}splits 3–3.
Props
| Prop | Type | Required |
|---|---|---|
length | number | No |
value | string | No |
defaultValue | string | No |
onChange | (code: string) => void | No |
onComplete | (code: string) => void | No |
alphanumeric | boolean | No |
separatorAt | number | No |
error | boolean | No |
disabled | boolean | No |
label | string | No |
className | string | No |