define-form
define-form copied to clipboard
Radio Fields
When you specify a type="radio"
on the field, final-form is able to automatically deal with the checked attribute that radios require. I'm wondering how you'd go able dealing with that with this library.
I.E The following gives ts errors, but is legitimate.
<Row>
<ResponsiveColumn>
<Fields.tripType type="radio" value={"single"}>
{({ input }) => (
<RadioButton {...input}>
Single
</RadioButton>
)}
</Fields.tripType>
</ResponsiveColumn>
<ResponsiveColumn>
<Fields.tripType type="radio" value={"annual"}>
{({ input }) => (
<RadioButton {...input}>
Annual
</RadioButton>
)}
</Fields.tripType>
</ResponsiveColumn>
</Row>
(I'm not @ForbesLindesay ) maybe use custom render() func on Fields.tripType ?
<Fields.bio
render={({ input, meta }) => (
<div>
<label>Bio</label>
<textarea {...input} />
{meta.touched && meta.error && <span>{meta.error}</span>}
</div>
)}
/>