Home > database >  bootstrap form button is outside of the form div
bootstrap form button is outside of the form div

Time:12-30

I am using bootstrap and reactJS.

Please consider the following snippet:

<Form>
    <!--some stuff-->
    <Button type='submit'>
</Form>

the button is rendered outside my form as shown below :

button is outside the form

How can I bring my button inside of my form please ? I am using sass , so I can override bootstrap propreties if needed.

CodePudding user response:

Just wrap it with a FormGroup and add a minHeight to it:

<FormGroup style={{ minHeight: "50px" }} className="mb-2">
  <Button className="float-end" type="submit" variant="outline-primary">
    Submit
  </Button>
</FormGroup> 

Edit hungry-shadow-6lcp9

CodePudding user response:

You can wrap everything in a div like so

<FormWrapper class='form-wrapper'>
 <Form>
    <!--some stuff-->
 </Form>
 <Button type='submit'>
</FormWrapper>

CSS as so

.form-wrapper{
//styles here
}
  • Related