Skip to content
Code with resend, light
Light
Code with resend, dark
Dark

Every state

  • Code with resend, default, light
    Code with resend, default, dark

    default

  • Code with resend, focus, light
    Code with resend, focus, dark

    focus

  • Code with resend, verifying, light
    Code with resend, verifying, dark

    verifying

  • Code with resend, verified, light
    Code with resend, verified, dark

    verified

  • Code with resend, error, light
    Code with resend, error, dark

    error

  • Code with resend, resend-ready, light
    Code with resend, resend-ready, dark

    resend-ready

  • Code with resend, disabled, light
    Code with resend, disabled, dark

    disabled

Props

PropTypeDefaultWhat it does
idstring"email-code"Id of the real input; the label and lines below point at it.
namestring"code"Form field name.
labelstring"Enter the code from your email"Visible label.
emailstring"alex@example.com"Where the code went; shown masked as a••••@example.com.
lengthnumber6Number of digits.
defaultValuestring–Starting digits.
resendInnumber30Seconds left before a new code may be sent; the countdown starts from this after mount.
resendCooldownnumber30Wait 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.
errorMessagestring"That code doesn't match. Check the email or send a new code."Message for a wrong code.
disabledboolean–Disables the field and its buttons.
classNamestring–Extra classes on the outer Field.

More code inputs

All 4
otp-input-02 is in UI ProGet UI Pro, €199

Preview

Open the page
In UI Pro: get it, €199 once

With every block and theme. 400+ buyers since 2020. Plans