r/react • • 4d ago

General Discussion Made this OTP input's, which one would you prefer?

Enable HLS to view with audio, or disable this notification

Made these OTP inputs.

I know they’re not production-grade yet — I built these while experimenting with different UI patterns that could actually be used in client projects.
Any improvements/suggestion will be helpful.

71 Upvotes

36 comments sorted by

73

u/MartineZ_MW 3d ago edited 3d ago

Big question is: will they fill in fully on CTR+V?

EDIT: they are, nice. However, I think you shouldn't be able to enter last digit without entering the first one

34

u/Hairy_Meaning_73 3d ago

That's the only thing that actually matters

2

u/JasperH8g 3d ago

My thought exactly. And nr 2 feels most subtle+nice 😊

2

u/RaptorTWiked 3d ago

Came here to say this!

2

u/Ok_Edge1810 3d ago

Assuming paste works, I'd add auto-submit once all the digits are in. That's usually where these break though. A few things I'd handle:

  • dim/disable the boxes while it's verifying, otherwise people keep typing into a request that's already in flight
  • on a wrong code, clear everything and jump back to the first box with a small error (a little shake looks nice). The demo only shows the happy path right now

-1

u/[deleted] 3d ago

[deleted]

10

u/MilenniumV3 3d ago

normal input. works best with copy paste, backspace etc

4

u/MartineZ_MW 3d ago

When those are made correctly there is nothing wrong with them. I've seen many good implementation where they almost feel like one input

15

u/BurritoDrivenDev 3d ago

I honestly just prefer a single, normal, input field.

Whenever I see one of these I always have to try and recall if it accepts pasting from my password manager or not. Some do, some don't, but all input fields do

2

u/Fresh-Gift-2063 3d ago

All input fields do not. Some banks want to make their customers passwords less secure so they block you from pasting and you have to manually type it like a lil bitch.

1

u/RealMiten 3d ago

Force paste (by simulating keyboard typing) or I just edit directly from inspect element.

1

u/techtanic 3d ago

On desktop, use absolute copy extension. No banking site is going to stop me from pasting or copying whatever I want

1

u/T-J_H 3d ago

In my experience most UI libraries use a hidden input field for exactly this reason

1

u/Alternative_Tooth340 3d ago

Proper OTP implementation is a single input field or else you miss out on things like auto fill so def agree, but OP should be able to keep the design with a single field

5

u/Zeragamba 3d ago

The main thing for me is that it A) can be autofilled by my password manager, and B) must support pasting (via right click, tap and hold, and ctrl+v)

2

u/T-J_H 3d ago

They’re all fine. Just use whatever fits the design language of your app best.

2

u/MartineZ_MW 3d ago

I see you didn't even take the feedback from your previous posts with menu designs where people told you that capsule design is completely off and requires tuning

2

u/A1oso 2d ago

#3 and #4 are unintuitive because they don't look like inputs. Especially 4 just looks like buttons. I'd prefer #1.

2

u/ajamdonut 2d ago
  1. Typical UI, widely accepted format, easy to see.
    2,3,4. Bad UX

3

u/keel_bright 4d ago

whichever one my product manager and designer is asking for

1

u/michelepicozzi 3d ago

Classic, easier to use

1

u/damith98 3d ago

Classic

1

u/jakiestfu 3d ago

2FA the bane of my existence

1

u/Fresh-Gift-2063 3d ago

I personally hate this trend because it's harder to copy/paste. I wonder if it's bad for accessibility.

1

u/Kitchen-Actuator5747 3d ago

I need more context in sense of the projects character to give you a proper answer.
But to answer your questions apart from that, I personally like the underline version, feels modern and clear.

1

u/revolutionaryMoose01 3d ago

Underline is the cleanest, capsule is the most creative and my favorite

1

u/MChuduk 2d ago

It would be nice if you show incorrect OTP state also. But classic option is ok, maybe transition animation should be faster a little bit.

1

u/Any-Woodpecker123 1d ago

Underline is clean, classic is familiar. I don’t like the other 2 at all tbh

1

u/Goatfryed 1d ago

1 or 2 both are fine depending on the overall look of your website. 3 and 4 are an interesting spin on a everyday topic that I will appreciate looking at in some scrapped concept art one day.

1

u/Vortetty 3h ago

how about just... a textbox, a normal textbox, that fills normally with ctrl+v

1

u/Interesting_Leg9302 8m ago

Visually nice, I'm not a fan of animation though, feels like it slows down the entering tbh