PinInput

N-slot input for OTPs, PINs, and 2FA codes. Numeric or alphanumeric, optional mask, full paste support (paste the whole code anywhere — it spreads across slots), arrow keys + Backspace handled, fires onComplete when filled.

Try the correct code: 123456

Usage

import { PinInput } from '@bwo-ui/react';

<PinInput
  length={6}
  onComplete={(code) => verifyOtp(code)}
  autoFocus
/>

// Alphanumeric, masked
<PinInput length={8} type="alphanumeric" mask />

Props

PropTypeDefaultDescription
lengthnumber6Number of slots.
valuestringControlled value.
defaultValuestringUncontrolled default.
onValueChange(value: string) => voidFires on every change.
onComplete(value: string) => voidFires when the full PIN is filled.
type'numeric' | 'alphanumeric''numeric'Accepted character set.
maskbooleanfalseShow characters as bullets (password-style).
errorbooleanfalseShow error border.
size'sm' | 'md' | 'lg''md'Slot dimensions.
autoFocusbooleanfalseFocus the first slot on mount.