Have ideas to improve npm?Join in the discussion! »

    react-otpcode-input
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.2 • Public • Published

    react-otpcode-input

    An OTP input component using React

    Install

    npm install react-otpcode-input --save
    

    Usage

    ES6

    import OtpInput from 'react-otpcode-input';

    Typescript

    import OtpInput from 'react-otpcode-input';

    Props

    Props Options Default Description
    numberOfInputs Number none Number of OTP inputs to be rendered.
    onChange (code) => void none Returns OTP code typed in inputs.
    onComplete (code) => void none Callback when OTP is completely filled.
    otp String none The value of the OTP passed into the component.
    disabled boolean none Disables all the inputs.
    autoFocus boolean none Auto focuses input on initial page load.

    Examples

    import OtpInput from 'react-otpcode-input';
    
    <OtpInput
      numberOfInputs={6}
      onChange={(code) => console.log(code)}
      onComplete={(code) => console.log(code)}
      otp={""}
      autoFocus={true}
    />

    License

    MIT

    Keywords

    Install

    npm i react-otpcode-input

    DownloadsWeekly Downloads

    61

    Version

    1.1.2

    License

    MIT

    Unpacked Size

    19.5 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar