Moey Icons
No results. Try “dialog”, “dark” or “grid”.
Forms

OTP input

One box per character, for verification codes and PINs. It stays one real input under the hood, so phones can fill the code straight from the SMS, pasting "123 456" works, and your form sees a normal field.

Check your email

We sent a 6-digit code to ana@moey.test. (Psst: it's 123456.)

That code isn't right. Try again.

Didn't get it?

<input class="form-control" name="code" data-moey-otp="6" required aria-label="Verification code">
<button type="button" class="btn btn-link" data-moey-countdown="30" data-moey-countdown-start>Resend code</button>

<script>
  code.addEventListener('moey:complete', async (e) => {
    const ok = await checkCode(e.detail.value);
    code.classList.toggle('is-invalid', !ok);       // red, with a little shake
  });
</script>
  • Typing moves along by itself; Backspace goes back; ← → move; click any box to change it.
  • Letters and spaces are dropped from number codes, so a pasted "123-456" becomes 123456.
  • When every box is full it fires moey:complete. data-moey-autosubmit sends the form right away.
  • It sets inputmode="numeric", autocomplete="one-time-code", pattern and the length for you — so required means "all boxes filled".

Groups, PINs and letters

data-moey-separator="3" adds a dash every 3 boxes. data-moey-mask shows dots (for PINs). data-moey-otp-type="alphanumeric" allows letters too, shown in capitals — handy for backup and gift codes.

<input class="form-control" data-moey-otp="6" data-moey-separator="3" aria-label="Code">
<input class="form-control" data-moey-otp="4" data-moey-mask aria-label="PIN">
<input class="form-control" data-moey-otp="8" data-moey-separator="4" data-moey-otp-type="alphanumeric" aria-label="Backup code">

Sizes and filled

.otp-sm and .otp-lg on the input, and .form-filled for the borderless look. On phones the boxes shrink to fit.

<input class="form-control otp-sm" data-moey-otp="6">
<input class="form-control otp-lg form-filled" data-moey-otp="4">

Send it when it's full

data-moey-autosubmit submits the form as soon as the last digit is in — no button press needed. The button is still there for people who prefer it.

<form>
  <input class="form-control" name="pin" data-moey-otp="4" data-moey-autosubmit aria-label="Door PIN">
</form>

Countdown buttons

Works on any button: after a click it waits (disabled) and shows the time left. data-moey-countdown-start waits right away; data-moey-countdown-text sets the waiting text.

<button class="btn" data-moey-countdown="10">Resend code</button>
<button class="btn" data-moey-countdown="15" data-moey-countdown-text="Try again in {time}">Send magic link</button>

<script>
  Moey.countdown(button, 60);                       // start one from code
  button.addEventListener('moey:countdown-end', …);
</script>
Class / attributeWhat it does
data-moey-otp="6"Boxes for a 6-character code (or use maxlength)
data-moey-separator="3"A dash after every 3 boxes
data-moey-otp-type="alphanumeric"Letters and numbers (shown in capitals)
data-moey-maskDots instead of the characters
data-moey-autosubmitSend the form when it's full
placeholder="000000"A faint hint in each box
.otp-sm · .otp-lg · .form-filled · .is-invalidSizes · borderless · wrong code (red, shakes)
moey:completeEvery box filled (e.detail.value)
data-moey-countdown="30" · -start · -textA button that waits before it can be clicked again