Skip to content

InputOTP

Type or paste a numeric code and preserve leading zeros.

alpina-ui/interactive/input-otp

Interactive preview

Enter the six digits you received by SMS.

Usage notes

Formatted-paste handling respects read-only and disabled fields. Editable inputs retain leading zeros and normalize full-width digits.

When to use

Collect a short verification code delivered through a separate channel when every position belongs to the same value.

When to avoid

Use a password field for reusable credentials of arbitrary length.

Accessibility

Label the whole code, allow pasting and test one-time-code autofill. Explain how to request a new code when the first expires.

Keys
KeyAction
DigitsEnter the code in one input. The visual boxes follow the same value.
← / →Move the text caret.
Backspace / DeleteRemove digits using native text editing.
Ctrl+V / ⌘VPaste the code into the field.

Content

State the number of digits once in the instruction. Keep delivery and expiry details in a separate sentence.

Use
Enter the six-digit code from your email.
Avoid
Fill in each box one character at a time.

Copy in four languages

German
Sechsstelligen Code eingeben28 characters
French
Saisir le code à six chiffres29 characters
Italian
Inserire il codice a sei cifre30 characters
Romansh
Endatar il code da sis cifras29 characters
Add to your project
npx --no-install alpina add input-otp