Skip to content

How to integrate RadixUI Themes controls with react-hook-form register()? #159

Closed Answered by chrishoermann
nemanjam asked this question in Q&A
Discussion options

You must be logged in to vote

In this case you'll need to use controller since the state of the component is in the onCheckedChange and not the on change handler - see Switch Primitive Doc

something like this:

<Controller
   control={form.control}
   name={name}
   render={({ field }) => (
       <Switch checked={field.value} onCheckedChange={field.onChange} />    
   )}
/>

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by nemanjam
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants