- Docs
- Components
- 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
| Keys | What happens |
|---|---|
| 0–9 | Fills a slot and moves on. |
| BackspaceDelete | Clears and moves back. |
| ←→ | Moves between slots. |
| ControlCommand V | Pastes 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