Repository navigation
Closed
Labels
component: otp fieldscope: new proposalProposal to increase the product scope covered.type: new featureExpand the scope of the product to solve a new problem.
Description
Summary
I believe it would be fantastic to introduce a base-ui hook specifically designed for handling OTP inputs.
Chakra already offers a PinInput component along with a headless UI hook in their Zag library (https://zagjs.com/components/react/pin-input).
Examples
No response
Motivation
No response
Search keywords:
Features to support
- Past from plain string, e.g. pasting
990312on mobile should fill the whole component. - Caret should be managed as if it was a single
<input>. - Be 6 pins by default, most common use case is 2FA
- Submit form after past when pressing Enter
Benchmarks
- https://app.link.com/login has a nice one
- https://www.radix-ui.com/primitives/docs/components/one-time-password-field
- https://zagjs.com/components/react/pin-input
- https://chakra-ui.com/docs/components/pin-input
- https://vuetifyjs.com/en/components/otp-input/
- https://mantine.dev/core/pin-input/
- https://www.radix-vue.com/components/pin-input
- https://twitter.com/liampmccabe/status/1754450110992244830
Reacted by Marc Pacheco García, sai chand, Olivier Tassinari, Paulus Pärssinen, Jurj Andrei George, Stefano, Eugene, Jian Zhang, kedom, Smit Dhameliya and 25 more
Metadata
Metadata
Assignees
Labels
component: otp fieldscope: new proposalProposal to increase the product scope covered.type: new featureExpand the scope of the product to solve a new problem.
Projects
- StatusShow more project fieldsRecently completed
Activity
michaldudak commentedon Jan 17, 2024
👍 Let's wait for the community upvotes so we can prioritize this.
[-][base-ui] Add a hook to manage OTP Inputs `usePinInput`[/-][+][base-ui] Add a hook, support OTP/ PinInput `usePinInput`[/+]oliviertassinari commentedon Jan 17, 2024
I have added a few benchmarks.
2FA grew in popularity recently, and so did this component. I wonder about the impact passwordless (biometric, passkey, device, email link) authentification will have though.
TheOneTheOnlyJJ commentedon Feb 3, 2024
It would be great to have this in Material UI as well, not only here in Base UI.
oliviertassinari commentedon Feb 27, 2024
@michaldudak before we transfer issues, we need to create the labels. We loose all of that data otherwise.
[-][base-ui] Add a hook, support OTP/ PinInput `usePinInput`[/-][+][OtpInput] Add a hook, support OTP/ PinInput `usePinInput`[/+]dantman commentedon Jun 28, 2024
The email link flow has the downside of a poor user experience if the device they are using to read the email and the device they are trying to login with are different. The alternative flow is one where a pin is emailed and entered the same way as an OTP could potentially become more common. That's actually the exact scenario that prompted me to make the web search that included this page as a result.
[-][OtpInput] Add a hook, support OTP/ PinInput `usePinInput`[/-][+][OtpInput] Add a OtpInput or PinInput component[/+][-][OtpInput] Add a OtpInput or PinInput component[/-][+][ott] Add a OtpInput or PinInput component[/+][-][ott] Add a OtpInput or PinInput component[/-][+][otp] Add a OtpInput or PinInput component[/+]controversial commentedon Aug 11, 2025
Note this component is now available in Radix
oliviertassinari commentedon Aug 11, 2025
@controversial Thanks for flagging, added to the list above. However, it's not usuabe for me on Android with the SwiftKey keyboard.
linear commentedon Mar 22, 2026
BAS-483
github-actions commentedon Apr 10, 2026
This feature will be available in the next npm release of Base UI.
In the meantime, you can try it out on our Canary release channel:
[-][otp] Add a OtpInput or PinInput component[/-][+][otp field] Add a OtpInput or PinInput component[/+]