Skip to content

Input OTP

Value:
Terminal window
npx skeci-ui add input-otp
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>

Small Rounded

Large

PropTypeDefaultDescription
maxLengthnumber (required)The maximum number of characters.
valuestringThe controlled value.
defaultValuestring''The initial value.
onChange(value: string) => voidCallback fired when the value changes.
onComplete(value: string) => voidCallback fired when all slots are filled.
disabledbooleanfalseWhether the input is non-interactive.
patternRegExpRegular expression to validate each character.
size'sm' | 'md' | 'lg''md'The size of the slots.
rounded'none' | 'sm' | 'md' | 'lg''none'Border radius of the slots.
PropTypeDefaultDescription
indexnumber (required)The index of the slot (0 to maxLength-1).