Skip to content

Rahul8320/otp-input

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OTP Input - React Machine Coding Interview Question Solution

Overview

A simple and customizable OTP (One-Time Password) input component built with React. This component allows users to input their OTP digit by digit, providing a smooth and user-friendly experience.

Table of Contents

Features

  • Digit-by-Digit Input: Users can enter their OTP one digit at a time.
  • Automatic Focus: Automatically moves focus to the next input field as the user types.
  • Backspace Navigation: Allows users to navigate back to the previous input field when deleting digits.
  • Customizable Length: Easily set the length of the OTP input.
  • Switch Between OTP Digits: Shift focus between OTP input fields using the left and right arrow keys.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • You have Node.js and npm installed on your machine. You can download them from nodejs.org.
  • A basic understanding of React and JavaScript.

Installation

To get an development setup ready, follow these steps:

  1. Clone the repository:

    git clone https://github.com/Rahul8320/otp-input.git
  2. Navigate to the project directory:

    cd otp-input
  3. Install the dependencies:

    npm install
  4. Run the app:

    npm start

    Runs the app in the development mode.
    Open http://localhost:3000 to view it in the browser.

  5. To ensure the integrity of the application, you can run the test suite using the following command:

    npm test

Styling

The component comes with basic styles. You can customize the styles further by adding your own CSS classes or inline styles.

Developed With

This project was developed using the following technologies:

  • React: A JavaScript library for building user interfaces.
  • JavaScript: The programming language used for the component logic.
  • HTML/CSS: For structuring and styling the component.
  • Jest: For writing and running unit tests.

Contributing

Contributions are welcome! If you have suggestions for improvements or new features, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

OTP Input - React Machine Coding Interview Question Solution

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published