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

Add "formElement" props to allow any element to be render as a form #599

Merged
merged 3 commits into from
Jan 20, 2021
Merged

Add "formElement" props to allow any element to be render as a form #599

merged 3 commits into from
Jan 20, 2021

Conversation

ThibautMarechal
Copy link
Contributor

@ThibautMarechal ThibautMarechal commented Jan 4, 2021

( Allow overriding the element to render as form )

  • Title is human readable, as it will be included directly in CHANGELOG.md when we do a release
  • If this is a new user-facing feature, documentation has been added to API.md
  • Any dist/ changes have not been committed.

Tests run directly on the source code and all dist changes are computed and committed during Formsy release.

  <Formsy as="div">
    ...
  </Formsy>

  <Formsy as={MyCustomFormElement}>
    ...
  </Formsy>

@rkuykendall
Copy link
Member

would formElement be a clearer prop here? I had to read the description to know what as was. Though I think it does make sense in context like as='div' but formElement='div' might be more clear?

API.md Outdated
@@ -293,6 +294,20 @@ class MyForm extends React.Component {
With the `preventExternalInvalidation` the input will not be invalidated though it has an error when
`updateInputsWithError()` or an `invalidate` callback is called.

### <a id="as">as</a>
By default Formy render the form with the HTML `form` element.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
By default Formy render the form with the HTML `form` element.
By default Formsy render the form with the HTML `form` element.

@ThibautMarechal
Copy link
Contributor Author

@rkuykendall Yes you're right, formElement is much more understandable. I made the changes

@ThibautMarechal ThibautMarechal changed the title Add "As" props to allo any element to be render as a form Add "formElement" props to allow any element to be render as a form Jan 16, 2021
@rkuykendall rkuykendall merged commit da6ed38 into formsy:master Jan 20, 2021
rkuykendall pushed a commit that referenced this pull request Jan 21, 2021
…599)

* add as props to render any elements

* add documentation

* rename 'as' props to 'formElement'

Co-authored-by: Thibaut Maréchal <t.marechal@evs.com>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants