devfolioco / react-otp-input

:heavy_check_mark: OTP Input Component for React
http://devfolioco.github.io/react-otp-input
MIT License
662 stars 427 forks source link

Autofocus first input when clear otp input #263

Open junghyeonsu opened 3 years ago

junghyeonsu commented 3 years ago

I want autofocus first input when click clear buttton. because i use this library as password input.

image when click clear button...

image

i think shouldAutoFocus works same what i need. but i don't know how to autofocus when i clicked clear button. If it doesn't matter, can I take on this issue?

shivakrishna17 commented 2 years ago

Did u found any solution for this??....As i am creating an application, when the user enters invalid input, i am setting it to empty, but the autoFocus is staying at last box.

blactrojan commented 2 years ago

https://github.com/devfolioco/react-otp-input/issues/306#issuecomment-1160417780

You can use this snippet and implement a similar one, just change focusInput to 0 and it should work

ritikbanger commented 2 years ago

The feature is available in: https://www.npmjs.com/package/react18-input-otp

imran-yasin commented 5 months ago

simple use this line renderInput={(props) => <input autoFocus {...props} />}

prodigiousabyss commented 2 months ago

It's not working for me.