OTP Input for React
One-time password input component for React. Accessible. Unstyled. Customizable. Open Source.
Usage
Then import the component.
Default example
The example below uses tailwindcss
@shadcn/ui
tailwind-merge
clsx
:
How it works
There's currently no native OTP/2FA/MFA input in HTML, which means people are either going with 1. a simple input design or 2. custom designs like this one.
This library works by rendering an invisible input as a sibling of the slots, contained by a relative
ly positioned parent (the container root called OTPInput).
API Reference
OTPInput
The root container. Define settings for the input via props. Then, use the render
prop to create the slots.