TrademarkTrademark
Docs
Ctrl k
Search docs...
Form Controls

OTPInput

Updated: October 18, 2026
View on GitHub
Soon
Not released yet. This is on main and is not in any published version yet. It will not install today.

OTPInput draws one field per digit of a one-time code. Each digit moves focus to the next field, and backspace in an empty field goes back to the one before. A code pasted into a field, or filled in from a text message, spreads across the fields from that one. onComplete gets the code once every field has a digit. See the web OTPInput for the browser version.

Basic usage

Errors

error draws every field in the danger colour. errorMessage shows under the fields and is announced when it appears.

Differences from the web

  • The first field sets textContentType="oneTimeCode" and autoComplete="sms-otp", so iOS and Android offer the code from a text message above the keyboard.
  • A pasted or autofilled code fills the following fields. On the web each field takes one character.
  • Each field is 56 points wide, not 48, to leave room for the field's side padding around a large digit.
  • The keyboard is a number pad. There are no arrow keys, so moving between fields is by tapping one.
  • OTPInput does not take the web's div props. Use style for the outer view.

API reference

Prop
Type
Default
Description
lengthnumber4How many digits.
onComplete(code: string) => voidCalled with the code once every field has a digit.
errorbooleanfalseDraws the fields in the danger colour.
errorMessageReactNodeShown under the fields while error is true.
disabledbooleanfalseDims the fields. They take no input.
autoFocusbooleanfalseFocuses the first field on mount.
styleViewStyleStyle for the outer view.
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club