Skip to content
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

Integration with React Hook Form #10

Closed
carvalhodanielg opened this issue Aug 29, 2022 · 3 comments
Closed

Integration with React Hook Form #10

carvalhodanielg opened this issue Aug 29, 2022 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@carvalhodanielg
Copy link

First of all, thanks for the amazing job building mui-tel-input, great job!

My question is, there is any chance of mui-tel-input being updated so it can be used wit react-hook-form so we can use it inside forms and work with better validation schemas.

In my custom input component, we use somethinig like this, so we can pass the register property and destructure it inside our base mui component.

<CustomInput register={register} name="name" />

<OutlinedInput {...(props.register && props.name && props.register(props.name))} />

@viclafouch
Copy link
Owner

viclafouch commented Aug 29, 2022

Hey ! I don't think there is any problem to use React-Hook-Form with MuiTelInput.

Here a simple example : https://codesandbox.io/s/react-hook-form-with-mui-tel-input-o530m7

Currently working on a website documentation for MuiTelInput. I let this issue opened until the documentation is ready.

@viclafouch viclafouch added the documentation Improvements or additions to documentation label Aug 29, 2022
@viclafouch viclafouch self-assigned this Aug 29, 2022
@viclafouch
Copy link
Owner

Hey !

A documented page for React Hook Form is available here : https://viclafouch.github.io/mui-tel-input/docs/react-hook-form/

@carvalhodanielg
Copy link
Author

Wow! Thank you very much for the answer and great documentation!

I saw your example and it really helped me!! I needed use it in a diferent way, because I am working with React Hook Form + Yup for validation. But it helped a lot. Once again, thank you very much!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants