-
-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pin Input Number only #566
Comments
I think this issue should be fixed in Melt UI. Actually someone already created an issue there and they gave him a temporary workaround. Here's the simplified version for Bits UI components. <script lang="ts">
import { PinInput } from "bits-ui";
let value: string[] | undefined = [];
let pinInputType: "text" | "password" | "number" = "number";
</script>
<!-- NOTE: this will throw a ts error on the type props, but it's just a workaround -->
<PinInput.Root bind:value type={pinInputType} placeholder="0">
...
</PinInput.Root> |
Thank you. It seems like it works. I had to trick it into letting the typescript error get around. One thing I noticed is that melt-ui uses the setSelectionRange which doesn't work with number inputs. Maybe that is why they never implemented numbers? Here is the error I get. It still works however.
You are right this is probably more of a melt-ui feature that needs to get thought out. |
Closed as implemented in |
Describe the feature in detail (code, mocks, or screenshots encouraged)
Is it possible to make the pin input accept only a number. If we did this then when viewing it on a phone with the keyboard we would get the number pad only. Right now its a pain since each time you type a character, you have to select Number mode, press one number, then keyboard jumps back to qwerty keyboard
What type of pull request would this be?
None
Provide relevant links or additional information.
No response
The text was updated successfully, but these errors were encountered: