OTP Field
A one-time code field — one square box per character, paste-aware, with the caret moving itself.
Loading documentation…
We sent a six-digit code to your email.
OtpField is the two-factor box: one slot per character, the caret moving
itself as you type, and a paste anywhere in the field filling every slot at
once.
The slots are square, and on the same 8px rhythm as every other control —
base is the 32px control height. A taller-than-wide slot reads as a text
field that has been squashed; a square one reads as a keycap, which is what it
is.
groupAfter inserts a dash after n slots. It is cosmetic, but it makes a
six-digit code readable as two chunks instead of one blur.
onValueComplete fires the moment the last slot is filled — by typing or by
pasting — which is where verification belongs. There is no submit button to
wait for.
How many slots. It defaults to 6.
Inserts a dash after this many slots — 3 gives 123-456.
28, 32 or 40px square. It defaults to base.
Controlled and uncontrolled value.
Fires on every keystroke.
Fires when every slot is filled.
Masks the entered characters.
Submits the owning form once the code is complete.
What the field accepts. It defaults to numeric, which also sets the
on-screen keyboard.
The same field layout every heyo-ui control composes. See
Field.
Standard form behaviour, passed through to Base UI.