react-otp-input-z
Version:
React hook otp input, copy paste, etc... (Lib)
41 lines (40 loc) • 1.24 kB
TypeScript
/// <reference types="react" />
interface IBaseProps {
className?: string;
otpClassName?: string;
type?: 'number' | 'text';
secret?: boolean;
disabled?: boolean;
readonly?: boolean;
useUpDownArrow?: boolean;
selectionOnFocus?: boolean;
}
export interface IOTPElementProps extends IBaseProps {
value: string;
setValue: (value: string) => void;
onSingleDone?: (isBack?: boolean) => void;
onPasted: (value: string[]) => void;
onKeyEnter?: () => void;
}
export interface IOTPProps extends IBaseProps {
/** has error => Apply default class error */
hasError?: boolean;
/** otp value */
value?: string | string[];
/** Enable copy/paste */
enablePaste?: boolean;
/** Enable copy full */
autoPasteFull?: boolean;
splitIcon?: React.ReactNode | string;
/** Otp size (default 4) */
otpSize?: number;
/** Focus input */
autoFocus?: boolean;
/** Display only border bottom */
isKeyCard?: boolean;
/** When input doned */
onCompleted?: (value: string[] | string, isDone: boolean) => void;
/** When Enter input */
onEnter?: (value: string[] | string, isDone: boolean) => void;
}
export {};