Give your forms some structure—from inline to horizontal to custom grid implementations—with our form layout options.

Form's layout on Bootstrap

Margin utilities are the easiest way to add some structure to forms. They provide basic grouping of labels, controls, optional form text, and form validation messaging. We recommend sticking to margin-bottom utilities, and using a single direction throughout the form for consistency.

<div class="mb-3"><label class="form-label" for="formGroupExampleInput">Example label</label><input class="form-control" id="formGroupExampleInput" type="text" placeholder="Example input placeholder" /></div>
<div class="mb-3"><label class="form-label" for="formGroupExampleInput2">Another label</label><input class="form-control" id="formGroupExampleInput2" type="text" placeholder="Another input placeholder" /></div>
Form grid

More complex forms can be built using our grid classes. Use these for form layouts that require multiple columns, varied widths, and additional alignment options.

Requires the $enable-grid-classes Sass variable to be enabled (on by default).
<div class="row">
  <div class="col"><input class="form-control" type="text" placeholder="First name" aria-label="First name" /></div>
  <div class="col"><input class="form-control" type="text" placeholder="Last name" aria-label="Last name" /></div>

By adding gutter modifier classes, you can have control over the gutter width in as well the inline as block direction. Also requires the $enable-grid-classes Sass variable to be enabled (on by default).

<div class="row g-3">
  <div class="col"><input class="form-control" type="text" placeholder="First name" aria-label="First name" /></div>
  <div class="col"><input class="form-control" type="text" placeholder="Last name" aria-label="Last name" /></div>
Horizontal form

Create horizontal forms with the grid by adding the .row class to form groups and using the .col-*-* classes to specify the width of your labels and controls. Be sure to add .col-form-label to your <label>s as well so they’re vertically centered with their associated form controls.

At times, you maybe need to use margin or padding utilities to create that perfect alignment you need. For example, we’ve removed the padding-top on our stacked radio inputs label to better align the text baseline.

  <div class="row mb-3"><label class="col-sm-2 col-form-label" for="inputEmail3">Email</label>
    <div class="col-sm-10"><input class="form-control" id="inputEmail3" type="email" /></div>
  <div class="row mb-3"><label class="col-sm-2 col-form-label" for="inputPassword3">Password</label>
    <div class="col-sm-10"><input class="form-control" id="inputPassword3" type="password" /></div>
    <div class="row mb-3"><label class="col-form-label col-sm-2 pt-0">Radios</label>
      <div class="col-sm-10">
        <div class="form-check"><input class="form-check-input" id="gridRadios1" type="radio" name="gridRadios" value="option1" checked="" /><label class="form-check-label" for="gridRadios1">First radio</label></div>
        <div class="form-check"><input class="form-check-input" id="gridRadios2" type="radio" name="gridRadios" value="option2" /><label class="form-check-label" for="gridRadios2">Second radio</label></div>
        <div class="form-check disabled"><input class="form-check-input" id="gridRadios3" type="radio" name="gridRadios" value="option3" disabled="" /><label class="form-check-label" for="gridRadios3">Third disabled radio</label></div>
  <div class="row mb-3">
    <div class="col-form-label col-sm-2 pt-0">Checkbox</div>
    <div class="col-sm-10">
      <div class="form-check"><input class="form-check-input" id="gridCheck1" type="checkbox" /><label class="form-check-label" for="gridCheck1">Example checkbox</label></div>
  </div><button class="btn btn-primary" type="submit">Sign in</button>
Horizontal form label sizing

Be sure to use .col-form-label-sm or .col-form-label-lg to your <label>s or <legend>s to correctly follow the size of .form-control-lg and .form-control-sm.

<div class="row mb-3"><label class="col-sm-2 col-form-label col-form-label-sm" for="colFormLabelSm">Email</label>
  <div class="col-sm-10"><input class="form-control form-control-sm" id="colFormLabelSm" type="email" placeholder="col-form-label-sm" /></div>
<div class="row mb-3"><label class="col-sm-2 col-form-label" for="colFormLabel">Email</label>
  <div class="col-sm-10"><input class="form-control" id="colFormLabel" type="email" placeholder="col-form-label" /></div>
<div class="row"><label class="col-sm-2 col-form-label col-form-label-lg" for="colFormLabelLg">Email</label>
  <div class="col-sm-10"><input class="form-control form-control-lg" id="colFormLabelLg" type="email" placeholder="col-form-label-lg" /></div>
Inline forms

Use the .col-auto class to create horizontal layouts. By adding gutter modifier classes, we’ll have gutters in horizontal and vertical directions. The .align-items-center aligns the form elements to the middle, making the .form-checkbox align properly.

Be sure to always include a label with each form control, even if you need to hide it from non-screenreader visitors with .sr-only.

<form class="row row-cols-lg-5 g-3 align-items-center">
  <div class="col-12"><label class="sr-only" for="inlineFormInputName">Name</label><input class="form-control" id="inlineFormInputName" type="text" placeholder="Jane Doe" /></div>
  <div class="col-12"><label class="sr-only" for="inlineFormInputGroupUsername">Username</label>
    <div class="input-group">
      <div class="input-group-text">@</div><input class="form-control" id="inlineFormInputGroupUsername" type="text" placeholder="Username" />
  <div class="col-12"><label class="sr-only" for="inlineFormSelectPref">Preference</label><select class="form-select" id="inlineFormSelectPref">
      <option selected="">Choose...</option>
      <option value="1">One</option>
      <option value="2">Two</option>
      <option value="3">Three</option>
  <div class="col-12">
    <div class="form-check mb-0"><input class="form-check-input" id="inlineFormCheck" type="checkbox" /><label class="form-check-label" for="inlineFormCheck">Remember me</label></div>
  <div class="col-12"><button class="btn btn-primary" type="submit">Submit</button></div>

Thank you for creating with Falcon |
2021 © Themewagon