GithubHelp home page GithubHelp logo

otp's Introduction

Project logo

otp-mtolia

Status GitHub Issues GitHub Pull Requests License




Intro

Gif Başlığı



📝 Table of Contents


🧐 About

With this library, you can get a ready input where you can get your one-time passwords from the user and style it.

The user can fill in the input with a single button on the clipboard on ios devices.


🏁 Getting Started

This package is made for reactjs. First, review the Prerequisites section below. And if there is a missing package in your project, install it.

Prerequisites

What things you need to install the software and how to install them.

npm i react
npm i typescript

Installing

Firstly, add the npm package to your project by typing the following line into the terminal.

npm i otp-mtolia

🎈 Usage

With React Hook Form

import OtpInput from "otp-mtolia";
import React from "react";
import { Controller, SubmitHandler, useForm } from "react-hook-form";
import styles from "../otp/otp.module.scss";

interface otpForm {
  otp: any;
}

export const OtpScreen = () => {

  //#region Form & Submit
  const {
    handleSubmit,
    formState: { errors, isSubmitted, isValid },
    setValue,
  } = useForm<otpForm>({});

  const onSubmit: SubmitHandler<otpForm> = (data) => {
    console.log(data);
  };

  //#endregion

  //#region JSX
  return (
    <div className={styles.otpScreen}>

      <h4>OTP Page</h4>

      <form onSubmit={handleSubmit(onSubmit)}>

        {/* OTP From Package*/}
        <OtpInput inputCount={6} onChangedOtp={(value: string) => setValue('otp', value)} inputClassName={styles.otpInput} />

        <button type="submit">  Submit </button>
      </form>
      
    </div>
  );
  //#endregion
};




Key Type Default Description
@Input inputCount number 4 Otp input count
@Input inputClassName string "" You can style the input by assigning a value to the class name you have given to this field.
@Output onChangedOtp Function - Last value entered in the input



⛏️ Built Using

✍️ Authors

otp's People

Watchers

Güliz AY avatar Gizem avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.