Docs
Input OTP
Input OTP
Accessible one-time password component with copy paste functionality.
About
Input OTP is built on top of input-otp by @guilherme_rodz.
Installation
Run the following command:
Update tailwind.config.js
Add the following animations to your tailwind.config.js
file:
Usage
Examples
Pattern
Use the pattern
prop to define a custom pattern for the OTP input.
Separator
You can use the <InputOTPSeparator />
component to add a separator between the input groups.
Controlled
You can use the value
and onChange
props to control the input value.
Enter your one-time password.
Form
Changelog
2024-03-19 Composition
We've made some updates and replaced the render props pattern with composition. Here's how to update your code if you prefer the composition pattern.
Note: You are not required to update your code if you are using the
render
prop. It is still supported.
Update to the latest version of input-otp
.
Update input-otp.tsx
Then replace the render
prop in your code.
2024-03-19 Disabled
To add a disabled state to the input, update <InputOTP />
as follows: