Forms

Examples and usage guidelines for form control styles, layout options and custom components for creating a wide variety of forms with the help of Bootstrap Forms.

Overview

Bootstrap's form controls expand on Bootstrap Rebooted form styles with classes. Use these classes to opt into their customized displays for a more consistent rendering across browsers and devices.

Be sure to use an appropriate type attribute on all inputs (e.g., email for email address or number for numerical information) to take advantage of newer input controls like email verification, number selection and more.

For more information, see Bootstrap Forms

Here's a quick example to demonstrate Bootstrap's form styles. Keep reading for documentation on required classes, form layout and more.

We'll never share your email with anyone else.
                      
                        <form>
                          <div class="form-group">
                            <label for="exampleInputEmail1">Email address</label>
                            <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
                            <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
                          </div>
                          <div class="form-group">
                            <label for="exampleInputPassword1">Password</label>
                            <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
                          </div>
                          <div class="form-group form-check">
                            <input type="checkbox" class="form-check-input" id="exampleCheck1">
                            <label class="form-check-label" for="exampleCheck1">Check me out</label>
                          </div>
                          <button type="submit" class="btn btn-primary">Submit</button>
                        </form>
                      
                    

Form controls

Textual form controls—like <input>s, <select>s and <textarea>s—are styled with the .form-control class. Included are styles for general appearance, focus state, sizing and more.

Be sure to explore our custom forms to further style <select>s.

                      
                        <form>
                          <div class="form-group">
                            <label for="exampleFormControlInput1">Email address</label>
                            <input type="email" class="form-control" id="exampleFormControlInput1" placeholder="name@example.com">
                          </div>
                          <div class="form-group">
                            <label for="exampleFormControlSelect1">Example select</label>
                            <select class="form-control" id="exampleFormControlSelect1">
                              <option>1</option>
                              <option>2</option>
                              <option>3</option>
                              <option>4</option>
                              <option>5</option>
                            </select>
                          </div>
                          <div class="form-group">
                            <label for="exampleFormControlSelect2">Example multiple select</label>
                            <select multiple class="form-control" id="exampleFormControlSelect2">
                              <option>1</option>
                              <option>2</option>
                              <option>3</option>
                              <option>4</option>
                              <option>5</option>
                            </select>
                          </div>
                          <div class="form-group">
                            <label for="exampleFormControlTextarea1">Example textarea</label>
                            <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
                          </div>
                        </form>
                      
                    

For file inputs, swap the .form-control for .form-control-file.

                      
                        <form>
                          <div class="form-group">
                            <label for="exampleFormControlFile1">Example file input</label>
                            <input type="file" class="form-control-file" id="exampleFormControlFile1">
                          </div>
                        </form>
                      
                    

Sizing

Set heights using classes like .form-control-lg and .form-control-sm.

                      
                        <input class="form-control form-control-lg" type="text" placeholder=".form-control-lg">
                        <input class="form-control" type="text" placeholder="Default input">
                        <input class="form-control form-control-sm" type="text" placeholder=".form-control-sm">
                      
                    
                      
                        <select class="custom-select custom-select-lg">
                          <option>Large select</option>
                        </select>
                        <select class="custom-select">
                          <option>Default select</option>
                        </select>
                        <select class="custom-select custom-select-sm">
                          <option>Small select</option>
                        </select>
                      
                    

Custom form

For even more customization and cross browser consistency, use our completely custom form elements to replace the browser defaults. They’re built on top of semantic and accessible markup, so they’re solid replacements for any default form control.

Pilled form

Use the .form-pill modifier class to make inputs more rounded (with a larger border-radius).

                      
                        <div class="row">
                          <div class="col-md-6">
                            <div class="mb-3">
                              <input type="email" class="form-control form-pill" placeholder="Email" aria-label="Email">
                            </div>

                            <div class="mb-3">
                              <input type="password" class="form-control form-pill" placeholder="Password" aria-label="Password">
                            </div>
                          </div>

                          <div class="col-md-6">
                            <div class="mb-3">
                              <input type="text" class="form-control form-pill" placeholder="Readonly" aria-label="Readonly" readonly>
                            </div>

                            <div class="mb-3">
                              <input type="text" class="form-control form-pill" placeholder="Disabled" aria-label="Disabled" disabled>
                            </div>
                          </div>
                        </div>
                      
                    

Checkbox and radios

Default checkboxes and radios are improved upon with the help of .form-check, a single class for both input types that improves the layout and behavior of their HTML elements. Checkboxes are for selecting one or several options in a list, while radios are for selecting one option from many.

Disabled checkboxes and radios are supported, but to provide a not-allowed cursor on hover of the parent <label>, you’ll need to add the disabled attribute to the .form-check-input. The disabled attribute will apply a lighter color to help indicate the input’s state.

Checkboxes and radios use are built to support HTML-based form validation and provide concise, accessible labels. As such, our <input>s and <label>s are sibling elements as opposed to an <input> within a <label>. This is slightly more verbose as you must specify id and for attributes to relate the <input> and <label>.

Default (stacked)

By default, any number of checkboxes and radios that are immediate sibling will be vertically stacked and appropriately spaced with .form-check.

                      
                        <div class="form-check">
                          <input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
                          <label class="form-check-label" for="defaultCheck1">
                            Default checkbox
                          </label>
                        </div>
                        <div class="form-check">
                          <input class="form-check-input" type="checkbox" value="" id="defaultCheck2" disabled>
                          <label class="form-check-label" for="defaultCheck2">
                            Disabled checkbox
                          </label>
                        </div>
                      
                    
                      
                        <div class="form-check">
                          <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios1" value="option1" checked>
                          <label class="form-check-label" for="exampleRadios1">
                            Default radio
                          </label>
                        </div>
                        <div class="form-check">
                          <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios2" value="option2">
                          <label class="form-check-label" for="exampleRadios2">
                            Second default radio
                          </label>
                        </div>
                        <div class="form-check">
                          <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios3" value="option3" disabled>
                          <label class="form-check-label" for="exampleRadios3">
                            Disabled radio
                          </label>
                        </div>
                      
                    

Inline checkbox

Group checkboxes or radios on the same horizontal row by adding .form-check-inline to any .form-check.

                      
                        <div class="form-check form-check-inline">
                          <input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1">
                          <label class="form-check-label" for="inlineCheckbox1">1</label>
                        </div>
                        <div class="form-check form-check-inline">
                          <input class="form-check-input" type="checkbox" id="inlineCheckbox2" value="option2">
                          <label class="form-check-label" for="inlineCheckbox2">2</label>
                        </div>
                        <div class="form-check form-check-inline">
                          <input class="form-check-input" type="checkbox" id="inlineCheckbox3" value="option3" disabled>
                          <label class="form-check-label" for="inlineCheckbox3">3 (disabled)</label>
                        </div>
                      
                    
                      
                        <div class="form-check form-check-inline">
                          <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1">
                          <label class="form-check-label" for="inlineRadio1">1</label>
                        </div>
                        <div class="form-check form-check-inline">
                          <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2">
                          <label class="form-check-label" for="inlineRadio2">2</label>
                        </div>
                        <div class="form-check form-check-inline">
                          <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3" disabled>
                          <label class="form-check-label" for="inlineRadio3">3 (disabled)</label>
                        </div>
                      
                    

Custom checkbox

                      
                        <div class="custom-control custom-checkbox">
                          <input type="checkbox" class="custom-control-input" id="customCheck1">
                          <label class="custom-control-label" for="customCheck1">Checkbox label</label>
                        </div>

                        <div class="custom-control custom-checkbox">
                          <input type="checkbox" class="custom-control-input" id="customCheck2">
                          <label class="custom-control-label" for="customCheck2">Checkbox label</label>
                        </div>
                      
                    
                      
                        <div class="form-check position-relative mb-2">
                          <input type="radio" class="form-check-input d-none" id="customRadioboxes1" name="customRadioboxes">
                          <label class="radio radio-xxs form-check-label ml-1" for="customRadioboxes1"
                                 data-icon="&#xe946">Radio label</label>
                        </div>

                        <div class="form-check position-relative mb-2">
                          <input type="radio" class="form-check-input d-none" id="customRadioboxes2" name="customRadioboxes">
                          <label class="radio radio-xxs form-check-label ml-1" for="customRadioboxes2"
                                 data-icon="&#xe946">Radio label</label>
                        </div>
                      
                    

Switches

                      
                        <div class="custom-control custom-switch">
                          <input type="checkbox" class="custom-control-input" id="customSwitch1">
                          <label class="custom-control-label" for="customSwitch1">Unchecked switch</label>
                        </div>
                        <div class="custom-control custom-switch">
                          <input type="checkbox" class="custom-control-input" disabled id="customSwitch2" checked>
                          <label class="custom-control-label" for="customSwitch2">Checked switch</label>
                        </div>
                      
                    

Range

                      
                        <div class="mb-3">
                          <label class="text-muted" for="customRange1">Default range</label>
                          <input type="range" class="custom-range" value="80" id="customRange1">
                        </div>
                        <div>
                          <label class="text-muted" for="customRange2">Range with values for min-max and fixed step</label>
                          <input type="range" class="custom-range" min="0" max="50" value="5" step="10" id="customRange2">
                        </div>
                      
                    

Validation

Awesome supports bootstrap validation.