Feature: custom input registration
See original GitHub issueI think we could improve the DX a bit just by exporting the registered input already as a prop.
Currently if we want to make a custom input we need to do this:
<Field name="email">
{({ Label, Errors }) => (
<>
<Label />
<input
type="email"
{...register('email')}
className="border-2 border-dashed rounded-md"
/>
<Errors />
</>
)}
</Field>
Since the Field has the name it would make sense to just do this
<Field name="email">
{({ Label, Errors, props }) => (
<>
<Label />
<input type="email" {...props} className="border-2 border-dashed rounded-md" />
<Errors />
</>
)}
</Field>
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to Add Custom WooCommerce Registration Form Fields
Here are the quick and easy steps to enable WooCommerce registration form fields, and to add additional custom fields to the WooCommerce ...
Read more >How to Create a Custom User Registration Form in WordPress
First, you need to enter a name for your form at the top and then hover over the User Registration Form template. After...
Read more >Creating Custom Registration Fields - iThemes Help Center
This tutorial will walk you through how to add custom fields to these pages: Membership registration form [register_form]; Front-facing profile editor ...
Read more >How to add custom fields to the WordPress registration form
In this tutorial we'll learn how to programmatically add a custom field to the default WordPress registration form.
Read more >How to Add Extra Fields to Registration Form - Misha Rudrastyh
In this tutorial I will show how to add a phone number field into WooCommerce registration form with input mask and custom validation....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Note - For those who see the above and a wondering whats going on. When using Controller, if the
render
of the controller doesn’t put a hidden or otherwise input into the dom, this won’t work. So its a matter of addingHope this helps
Yup, the
register
approach is for uncontrolled components only. If you’d like to make it work with controlled components, you’ll need to useController
or implementvalue
andonChange
by hand, usingsetValue
to set the value.But I think the API you suggested is good for uncontrolled custom inputs. I’ll leave the issue open until we implement it.