Welcome to the React One-Time Password (OTP) Field component! This component will enable you to easily and efficiently implement an OTP input field in your react application. The component uses TailwindCSS for styling.
First install the only dependency:
# npm install clsx
Next, copy the code in the src file into your project and import it anywhere to get started!
import OTPField from '[PATH_TO_OTPField]';
// Render the OTPField
<OTPField length={4} />
Prop Name | Type | Description |
---|---|---|
length |
number | The number of OTP digits. |
className |
string | (Optional) Custom className to be added to the container. |
error |
boolean | (Optional) If true, it applies error styling to the input. |
Got ideas to make this component even more amazing? Create a pull request! 🤝
This project is licensed under the MIT License. See the LICENSE file for more details.
Having issues or need some help? Open an issue, and I'll do my best to assist you. I appreciate any feedback or suggestions to make this component better! 🙌
Made with 💙 by Shlok