OTPInput API
API reference docs for theOTPInputcomponent. For examples and details on the usage of this component, visit the component demo page.
Props
| Prop | Type | Description | Default |
|---|---|---|---|
value? | string | Controlled value of the OTP input. | '' |
length? | 4 | 5 | 6 | 7 | 8 | Number of input fields. | 6 |
mode? | 'numeric' | 'alphanumeric' | Input mode - numeric allows only numbers, alphanumeric allows letters and numbers. | 'numeric' |
autoFocus? | boolean | Auto-focus first input on mount. | false |
onChange? | (value: string) => void | Callback when value changes. | _ |
onComplete? | (value: string) => void | Callback when all fields are filled. | _ |
size? | 'standard' | 'large' | Size of the OTP input fields. | 'standard' |
label | string | Label for the OTP input field group. It will be visually hidden by default. | _ |
errorMessage? | string | Error message to display below the input. | _ |