Usage
import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot } from "@desk/ui/components/input-otp";Best practices
Set
maxLengthto the code length and render exactly that manyInputOTPSlots (index0…n-1) — a slot whoseindexexceedsmaxLengthnever fills.Drive it controlled with
value/onChange(a plain string), then verify the code once the string reaches fullmaxLength.Split slots into
InputOTPGroups with anInputOTPSeparatorbetween them for visual grouping only — it does not change the underlying value.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| index | number | Position in the OTP value this slot renders; its char/caret/active state is read from context by this index. |
Also exports
- component
InputOTP - component
InputOTPGroup - component
InputOTPSeparator