nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - Input type only accepts string

Open dl-web-dev opened this issue 3 years ago • 3 comments

NextUI Version

2.0.18

Describe the bug

Input component only accepts a value of type string and is forcing number input values to be converted to strings.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

  1. Attempt to set value of Input to anything other than a string

Expected behavior

Input allows value to be numbers in addition to strings.

Screenshots or Videos

Screenshot 2023-08-14 at 10 05 04 AM

Operating System Version

Any

Browser

Chrome

dl-web-dev avatar Aug 14 '23 15:08 dl-web-dev

I'll take this.

AabhasDhaubanja avatar Aug 14 '23 16:08 AabhasDhaubanja

Hey @dml0031 this is expected since the Input is based on useTextField react-aria hook https://react-spectrum.adobe.com/react-aria/useTextField.html#usetextfield, we will create a separate component based on the useNumberField hook for numeric inputs. In the meantime, you can cast the value from your side.

Stay tuned 👍🏻

jrgarciadev avatar Aug 15 '23 13:08 jrgarciadev

Got it, that was my temporary fix at all, was just a struggle for deeply nested objects but think I have a temp solution. Appreciate it.

dl-web-dev avatar Aug 15 '23 14:08 dl-web-dev