Skip to content
FormBrowse form components
ComponentsFormNew in 0.2

OTP / PIN

Slot-based code entry for 2FA and PINs. Per-slot focus + filled state.

Live preview

Usage

Adapters:React stableVue stable
index.html
<div class="lm-otp">
  <input class="lm-otp-slot" maxlength="1" aria-label="Digit 1 of 6" />
  <!-- … -->
</div>

CSS classes (3)

ClassDescription
lm-otpInline-flex slot wrapper
lm-otp-slotSingle character input
lm-otp-separatorVisual divider between groups

React props (2)

PropTypeDefaultDescription
lengthnumber6
groupsnumber[]e.g. [3, 3] renders two groups separated

Accessibility

  • Each slot needs aria-label='Digit n of m'.
  • Forward focus on input, backward on Backspace from empty slot.

Spotted something wrong? Edit this entry on GitHub.