Skip to content

Custom Layout with Submit Button #103

Answered by iway1
megacherry asked this question in Q&A
Discussion options

You must be logged in to vote

You should be able to pass a child <button type='submit'/> element in the layout:

<Form>
  {({fieldOne, fieldTwo})=>{
    return (
      <div>
        {fieldOne}
        <button type='submit'>
          Submit
        </button>
        {fieldTwo}
      </div>
    )
  }}
</Form>

Note that the layout will still be rendered within the form container in this case, so if you had a custom submit button in the container it will be rendered as well after the div here.

If you're planning on using custom layouts for all of your forms where you render the submit button in variable places in the UI, it might make sense to not have it be rendered in the form container at all and just render a <button/>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@megacherry
Comment options

Answer selected by megacherry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants