docs(www): add note on file input with react hook form#1379
docs(www): add note on file input with react hook form#1379zeekrey wants to merge 1 commit intoshadcn-ui:mainfrom
Conversation
|
@zeekrey is attempting to deploy a commit to the shadcn-pro Team on Vercel. A member of the Team first needs to authorize it. |
|
Hello there ! You might change name="pricture" to name="picture" And thank you very much for your PR, it saved me so much time. |
fcba8e0 to
fee012c
Compare
That's fantastic that it helped! 🥳 I've corrected the typo. Thank you for the helpful hint. |
|
This information is still missing in the docs |
|
And after I checked now I think the reason your example works is because you're stopping the value from getting spread onto the Input, it therefore becomming uncontrolled. This feels like a work-around. react-hook-form allows the mixed usage of controlled and uncontrolled components |
|
This PR has been automatically marked as stale due to one year of inactivity. It will be closed in 7 days unless there’s further input. If you believe this PR is still relevant, please leave a comment or provide updated details. Thank you. |
|
i just solved it with the same |
Hey there! 👋🏻
Thank you so much for creating this amazing content! 😍 This is my first PR in this repository, so please let me know if anything is missing or can be improved.
Intention
While all the components worked perfectly, I encountered some difficulties when using the
<Input />component withtype="file"and react hook forms. In my search for a solution, I came across these helpful discussions:It seems that I'm not the first one to have these questions.
Solution
I made a small addition to the
<Input />file example and included a tiny code snippet. I didn't include zod, as it was straightforward to usez.instanceof(File).I hope this is valuable. Please let me know if there's anything else I can do to make changes.