Skip to main content
  1. Docs
  2. Components
  3. Forms

OTP input

A one-time code in slots. Paste fills them all; the phone's SMS autofill lands in one go.

Import
@qeetrix/react/experimental
Status
ExperimentalSince 0.0.4
Renders
<input> per slotServer-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Keyboard

KeysWhat happens
0–9Fills a slot and moves on.
BackspaceDeleteClears and moves back.
←→Moves between slots.
ControlCommand VPastes the whole code into every slot.

02

Behaviour

Name
The slots are a group named by the field's label; the first slot takes that name too.
Position
Each other slot says where it is: "Character 2 of 6".
Autofill
autocomplete="one-time-code": the phone's SMS code lands in one go.
Narrow screens
The slots share the width and shrink to fit.

03

Tested

On every change, before it ships.

  • axe, WCAG 2.2 A and AA, in Chromium on every pull request
  • Firefox and WebKit every night
  • Forced colours, reduced motion and right to left
  • Every field shares one height and edge: a test checks them together
Next — OTP inputChangelog