

Every state


default


focus


verifying


verified


error


resend-ready


disabled
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| id | string | "email-code" | Id of the real input; the label and lines below point at it. |
| name | string | "code" | Form field name. |
| label | string | "Enter the code from your email" | Visible label. |
| string | "alex@example.com" | Where the code went; shown masked as a••••@example.com. | |
| length | number | 6 | Number of digits. |
| defaultValue | string | – | Starting digits. |
| resendIn | number | 30 | Seconds left before a new code may be sent; the countdown starts from this after mount. |
| resendCooldown | number | 30 | Wait after each resend, in seconds. |
| verify | (code: string) => Promise<boolean> | – | Checks a full code; the default accepts 246810 after a short delay. |
| onResend | () => Promise<void> | – | Sends a new code; the default waits briefly. |
| onChangeEmail | () => void | – | Runs on the Change email button. |
| onComplete | (code: string) => void | – | Fires once every box is filled, before the check runs. |
| status | "idle" | "verifying" | "verified" | "error" | – | Starting state, e.g. a result the server already has. |
| errorMessage | string | "That code doesn't match. Check the email or send a new code." | Message for a wrong code. |
| disabled | boolean | – | Disables the field and its buttons. |
| className | string | – | Extra classes on the outer Field. |
More code inputs
All 4otp-input-02 is in UI ProGet UI Pro, €199


