Releases: jungsoft/formup
Releases Β· jungsoft/formup
1.2.20
1.2.19
1.2.18
1.2.17
π₯ Extra formup information now available in FormInput component
When rendering custom inputs with FormInput
, now you can access more information related to formup, such as the validation error message!
-
You can pass the prop
injectFormupData
to a specificFormInput
component. This means thatFormInput
will inject a prop namedformupData
into the component it renders, passed with thecomponent
prop. -
In your custom component, can now access the prop
formupData
, which is an object containing all information! π₯
formupData
won't be injected into the final <input />
component, otherwise React will throw an error saying that formupData
is an invalid property for <input />
.
Here's an example:
- In
FormInput
, add theinjectFormupData
prop.
<FormInput
component={CustomInputWithErrorMessage}
injectFormupData={true}
name="email"
/>
- In your component, handle
formupData
prop:
const CustomInputWithErrorMessage = ({
formupData,
...props
}) => (
<>
{
formupData && formupData.errorMessage && (
<label>
{`Error: ${formupData && formupData.errorMessage}`}
</label>
)
}
<input
{...props}
/>
</>
);
1.2.16
1.2.00
π₯ Single-choice and multiple-choice input groups are here!
- You can use
FormInputGroup
andFormInputGroupItem
components to easily setup choice components in your form! - You can use the
multi
prop inFormInputGroup
to make the result an array and auto-validate selected options. - You can use the
initialValue
prop inFormInputGroup
to set initial checked items.
Here's an example:
<FormInputGroup name="gender">
<p>What's your gender?</p>
<FormInputGroupItem value="Male" />
<FormInputGroupItem value="Female" />
<FormInputGroupItem value="Non-binary" />
</FormInputGroup>