@usevyre/react@usevyre/vue

OTP Input

A segmented one-time-code input for verification and 2FA. Controlled —onChange emits the code string (never an event), and onComplete fires when it’s full. Paste a whole code and every slot fills; typing auto-advances, backspace steps back. Drops straight into Form.


6-digit code

Type or paste. onComplete fires once all six slots are filled — wire it to your verify call.

Enter the 6-digit code (try pasting "123456")

import { useState } from "react";
import { OTPInput } from "@usevyre/react";

const [code, setCode] = useState("");

<OTPInput
  value={code}
  onChange={setCode}
  onComplete={(c) => verify(c)}
  autoFocus
/>

Masked PIN

mask renders dots (like a password); combine withlength and size for a short PIN.

Masked 4-digit PIN

import { useState } from "react";
import { OTPInput } from "@usevyre/react";

const [pin, setPin] = useState("");

<OTPInput value={pin} onChange={setPin} length={4} mask size="lg" />

Props

Props

PropTypeDefaultDescription
valuestringControlled value. Omit for uncontrolled.
defaultValuestring""Initial value when uncontrolled.
onChange(value: string) => voidEmits the combined code string. NOT an event.
onComplete(value: string) => voidFires once when every slot is filled.
lengthnumber6Number of slots.
type"numeric" | "alphanumeric""numeric"Accepted characters.
maskbooleanfalseRender dots instead of characters.
size"sm" | "md" | "lg""md"Slot size.
disabledbooleanfalseDisable all slots.
autoFocusbooleanfalseFocus the first slot on mount (Vue: autofocus).
Emits a string, not an event. Like the other useVyre inputs, onChange gives you the value directly — so it works inFormField with no glue.