soywod / react-pin-field

📟 React component for entering PIN codes.
https://soywod.github.io/react-pin-field/
MIT License
412 stars 24 forks source link

Should allow setting `type=number` #90

Closed maged closed 6 months ago

maged commented 6 months ago

The type prop on the fields should be able to be set from the PinField component. This will allow using mobile browsers' numeric keyboards.

soywod commented 6 months ago

The type prop on the fields should be able to be set from the PinField component.

The component already forwards InputHTMLAttributes the inner inputs. So type=number already works. You have an example at https://soywod.github.io/react-pin-field/ with type=password.

This will allow using mobile browsers' numeric keyboards

You can also use inputMode. Try the demo from your mobile, you should see appropriate keyboards showing up.

maged commented 6 months ago

You are right, that works -- thanks for the fast response! Closing the issue. I assumed it was hard coded based on this https://github.com/soywod/react-pin-field/blob/master/lib/src/pin-field/pin-field.tsx#L316 🤔

soywod commented 6 months ago

I assumed it was hard coded

What you see is the default value, which can be overriden just after.