Components
InputOTP
One-time password input component for verification codes.
Usage
Best practices
Set
lengthto the code length and render exactly that manyInputOTPSlots - slots take their position from their order in the tree, so there is noindexprop.Drive it controlled with
value/onValueChange(a plain string), or react toonValueCompleteonce the string reaches fulllength.Characters are filtered by
validationType("numeric"by default;"alpha","alphanumeric"and"none"are also available) - pass"alphanumeric"for codes that contain letters.Split slots into
InputOTPGroups with anInputOTPSeparatorbetween them for visual grouping only - it does not change the underlying value.
Props
Also exports
- component
InputOTP - component
InputOTPGroup - component
InputOTPSeparator - component
InputOTPSlot