Easy Tutorial
❮ Bootstrap4 Colors Bootstrap4 Tutorial ❯

Bootstrap4 Form Controls

Bootstrap4 supports the following form controls:

Bootstrap Input

Bootstrap supports all HTML5 input types: text, password, datetime, datetime-local, date, month, time, week, number, email, url, search, tel, and color.

Note: If the input's type attribute is not properly declared, the input box's style will not display.

The following example uses two input elements, one is text, and the other is password:

Example

<div class="form-group">
  <label for="usr">Username:</label>
  <input type="text" class="form-control" id="usr">
</div>
<div class="form-group">
  <label for="pwd">Password:</label>
  <input type="password" class="form-control" id="pwd">
</div>

Bootstrap textarea

The following example demonstrates the style of a textarea.

Example

<div class="form-group">
  <label for="comment">Comment:</label>
  <textarea class="form-control" rows="5" id="comment"></textarea>
</div>

Bootstrap Checkbox

Checkboxes allow users to select from a set of pre-set options, choosing one or multiple options.

The following example includes three options. The last one is disabled:

Example

<div class="form-check">
  <label class="form-check-label">
    <input type="checkbox" class="form-check-input" value="">Option 1
  </label>
</div>
<div class="form-check">
  <label class="form-check-label">
    <input type="checkbox" class="form-check-input" value="">Option 2
  </label>
</div>
<div class="form-check disabled">
  <label class="form-check-label">
    &lt;input type="checkbox" class="form-check-input" value="" disabled>Option 3
  </label>
</div>

Using the .form-check-inline class allows options to be displayed in the same line:

Example

<div class="form-check form-check-inline">
  <label class="form-check-label">
    <input type="checkbox" class="form-check-input" value="">Option 1
  </label>
</div>
<div class="form-check form-check-inline">
  <label class="form-check-label">
    <input type="checkbox" class="form-check-input" value="">Option 2
  </label>
</div>
<div class="form-check form-check-inline disabled">
  <label class="form-check-label">
    &lt;input type="checkbox" class="form-check-input" value="" disabled>Option 3
  </label>
</div>

Bootstrap Radio

Radio buttons allow users to select from a set of pre-set options, but only one can be chosen.

The following example includes three options. The last one is disabled:

Example

<div class="radio">
  <label><input type="radio" name="optradio">Option 1</label>
<div class="radio">
  <label><input type="radio" name="optradio">Option 2</label>
</div>
<div class="radio disabled">
  <label>&lt;input type="radio" name="optradio" disabled>Option 3</label>
</div>

Using the .radio-inline class allows options to be displayed on the same line:

Example

<label class="radio-inline"><input type="radio" name="optradio">Option 1</label>
<label class="radio-inline"><input type="radio" name="optradio">Option 2</label>
<label class="radio-inline">&lt;input type="radio" name="optradio" disabled>Option 3</label>

Bootstrap Select Dropdown

When you want to let users select from multiple options, but only one option can be selected by default, use a select box.

The following example includes two dropdown menus:

Example

<div class="form-group">
  <label for="sel1">Dropdown:</label>
  <select class="form-control" id="sel1">
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
  </select>
</div>
❮ Bootstrap4 Colors Bootstrap4 Tutorial ❯