OTP input

Four boxes for a verification code.

CSS onlyNumeric keypad
BackgroundGridAccent

Corners

SharpDefaultRound

Shadow

NoneNoneStrong

Motion

NoneDefaultBounce
<style>
.ux-otp{display:flex;gap:10px}
.ux-otp input{width:48px;height:56px;text-align:center;font:600 22px system-ui;border-radius:calc(12px * var(--r,1));border:1.5px solid var(--line,#cfd2da);background:var(--soft,#eceef3);color:var(--fg,#14151a);outline:0;transition:border-color var(--dur,.15s) var(--ease,ease),box-shadow var(--dur,.15s) var(--ease,ease),background var(--dur,.15s) var(--ease,ease)}
.ux-otp input:focus{border-color:var(--accent,#cc4a26);background:var(--bg,#fff);box-shadow:0 0 0 4px color-mix(in srgb,var(--accent,#cc4a26) 20%,transparent)}
</style>

<div class="ux-otp">
  <input inputmode="numeric" maxlength="1" aria-label="Digit 1" value="4">
  <input inputmode="numeric" maxlength="1" aria-label="Digit 2" value="2">
  <input inputmode="numeric" maxlength="1" aria-label="Digit 3">
  <input inputmode="numeric" maxlength="1" aria-label="Digit 4">
</div>

When to use it

Use this inside a form where people type or paste information. It should feel at home next to your other fields, with the same spacing and focus style.

Accessibility

Check that it reaches every state with the keyboard alone before you ship it, and keep the focus ring instead of removing it for looks. It has no JavaScript dependency, so it keeps working if a script fails to load, and it is built on native form controls or semantics rather than divs pretending to be one. Colors are read from CSS custom properties, so they follow your light or dark theme and you can raise contrast globally without touching this component.