Hooks

useOtpInput

Publisher

cermuel

50 hooks published

More from this publisher

useOtpInput

Handle OTP boxes, pasting, and focus movement.

useOtpInput.tsx
import { useOtpInput } from "@cermuel/hooks/react";export function useOtpInputExample() {  const otp = useOtpInput(6);  return <p>{otp.value}</p>;}

Props

Param
Type
Default Value
length
number

Returns

{ digits: string[]; value: string; complete: boolean; setDigit: (index: number, value: string) => void; paste: (value: string) => void; clear: () => void; }