Bootstrap Forms
Examples and usage guidelines for form control styles, layout options, and custom components for creating a wide variety of Bootstrap forms.
Default
<form>
<div class= "row" >
<div class= "col-md-6" >
<div class= "form-group" >
<input type= "email" class= "form-control" id= "exampleFormControlInput1" placeholder= "[email protected] " >
</div>
</div>
<div class= "col-md-6" >
<div class= "form-group" >
<input type= "text" placeholder= "Regular" class= "form-control" disabled />
</div>
</div>
</div>
<div class= "row" >
<div class= "col-md-6" >
<div class= "form-group" >
<div class= "input-group mb-4" >
<span class= "input-group-text" ><i class= "ni ni-zoom-split-in" ></i></span>
<input class= "form-control" placeholder= "Search" type= "text" >
</div>
</div>
</div>
<div class= "col-md-6" >
<div class= "form-group" >
<div class= "input-group mb-4" >
<input class= "form-control" placeholder= "Birthday" type= "text" >
<span class= "input-group-text" ><i class= "ni ni-zoom-split-in" ></i></span>
</div>
</div>
</div>
</div>
<div class= "row" >
<div class= "col-md-6" >
<div class= "form-group has-success" >
<input type= "text" placeholder= "Success" class= "form-control is-valid" />
</div>
</div>
<div class= "col-md-6" >
<div class= "form-group has-danger" >
<input type= "email" placeholder= "Error Input" class= "form-control is-invalid" />
</div>
</div>
</div>
</form>
Alternative
If you want to use forms on grayish background colors, you can use this beautiful alternative style which removes the borders and it is emphasized only by its shadow.
<div class= "p-4 bg-secondary" >
<form>
<div class= "row" >
<div class= "col-md-6" >
<div class= "form-group" >
<input type= "email" class= "form-control form-control-alternative" id= "exampleFormControlInput1" placeholder= "[email protected] " >
</div>
</div>
<div class= "col-md-6" >
<div class= "form-group" >
<input type= "text" placeholder= "Regular" class= "form-control form-control-alternative" disabled />
</div>
</div>
</div>
<div class= "row" >
<div class= "col-md-6" >
<div class= "form-group" >
<div class= "input-group input-group-alternative mb-4" >
<span class= "input-group-text" ><i class= "ni ni-zoom-split-in" ></i></span>
<input class= "form-control form-control-alternative" placeholder= "Search" type= "text" >
</div>
</div>
</div>
<div class= "col-md-6" >
<div class= "form-group" >
<div class= "input-group input-group-alternative mb-4" >
<input class= "form-control" placeholder= "Birthday" type= "text" >
<span class= "input-group-text" ><i class= "ni ni-zoom-split-in" ></i></span>
</div>
</div>
</div>
</div>
<div class= "row" >
<div class= "col-md-6" >
<div class= "form-group has-success" >
<input type= "text" placeholder= "Success" class= "form-control form-control-alternative is-valid" />
</div>
</div>
<div class= "col-md-6" >
<div class= "form-group has-danger" >
<input type= "email" placeholder= "Error Input" class= "form-control form-control-alternative is-invalid" />
</div>
</div>
</div>
</form>
</div>
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.
For all form control you can apply the additional modifier classes explained in the Inputs section: .form-control-alternative
, .form-control-flush
and .form-control-muted
.
<form>
<div class= "form-group" >
<label for= "exampleFormControlInput1" > Email address</label>
<input type= "email" class= "form-control" id= "exampleFormControlInput1" placeholder= "[email protected] " >
</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>
<form>
<div class= "form-group" >
<label for= "example-text-input" class= "form-control-label" > Text</label>
<input class= "form-control" type= "text" value= "John Snow" id= "example-text-input" >
</div>
<div class= "form-group" >
<label for= "example-search-input" class= "form-control-label" > Search</label>
<input class= "form-control" type= "search" value= "Tell me your secret ..." id= "example-search-input" >
</div>
<div class= "form-group" >
<label for= "example-email-input" class= "form-control-label" > Email</label>
<input class= "form-control" type= "email" value= "@example.com" id= "example-email-input" >
</div>
<div class= "form-group" >
<label for= "example-url-input" class= "form-control-label" > URL</label>
<input class= "form-control" type= "url" value= "" id= "example-url-input" >
</div>
<div class= "form-group" >
<label for= "example-tel-input" class= "form-control-label" > Phone</label>
<input class= "form-control" type= "tel" value= "40-(770)-888-444" id= "example-tel-input" >
</div>
<div class= "form-group" >
<label for= "example-password-input" class= "form-control-label" > Password</label>
<input class= "form-control" type= "password" value= "password" id= "example-password-input" >
</div>
<div class= "form-group" >
<label for= "example-number-input" class= "form-control-label" > Number</label>
<input class= "form-control" type= "number" value= "23" id= "example-number-input" >
</div>
<div class= "form-group" >
<label for= "example-datetime-local-input" class= "form-control-label" > Datetime</label>
<input class= "form-control" type= "datetime-local" value= "2018-11-23T10:30:00" id= "example-datetime-local-input" >
</div>
<div class= "form-group" >
<label for= "example-date-input" class= "form-control-label" > Date</label>
<input class= "form-control" type= "date" value= "2018-11-23" id= "example-date-input" >
</div>
<div class= "form-group" >
<label for= "example-month-input" class= "form-control-label" > Month</label>
<input class= "form-control" type= "month" value= "2018-11" id= "example-month-input" >
</div>
<div class= "form-group" >
<label for= "example-week-input" class= "form-control-label" > Week</label>
<input class= "form-control" type= "week" value= "2018-W23" id= "example-week-input" >
</div>
<div class= "form-group" >
<label for= "example-time-input" class= "form-control-label" > Time</label>
<input class= "form-control" type= "time" value= "10:30:00" id= "example-time-input" >
</div>
<div class= "form-group" >
<label for= "example-color-input" class= "form-control-label" > Color</label>
<input class= "form-control" type= "color" value= "#5e72e4" id= "example-color-input" >
</div>
</form>
Sizing
<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" >
Large select
Default select
Small select
<select class= "form-control form-control-lg" >
<option> Large select</option>
</select>
<select class= "form-control" >
<option> Default select</option>
</select>
<select class= "form-control form-control-sm" >
<option> Small select</option>
</select>
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.
Checkboxes
<div class= "form-check" >
<input class= "form-check-input" type= "checkbox" value= "" id= "fcustomCheck1" checked= "" >
<label class= "custom-control-label" for= "customCheck1" > Check this custom checkbox</label>
</div>
Radios
<div class= "form-check mb-3" >
<input class= "form-check-input" type= "radio" name= "flexRadioDefault" id= "customRadio1" >
<label class= "custom-control-label" for= "customRadio1" > Toggle this custom radio</label>
</div>
<div class= "form-check" >
<input class= "form-check-input" type= "radio" name= "flexRadioDefault" id= "customRadio2" >
<label class= "custom-control-label" for= "customRadio2" > Or toggle this other custom radio</label>
</div>
Disabled
<div class= "form-check" >
<input type= "checkbox" class= "form-check-input" id= "customCheckDisabled" disabled >
<label class= "custom-control-label" for= "customCheckDisabled" > Check this custom checkbox</label>
</div>
<div class= "form-check" >
<input type= "radio" id= "radio3" name= "radioDisabled" id= "customRadioDisabled" class= "form-check-input" disabled >
<label class= "custom-control-label" for= "customRadioDisabled" > Toggle this custom radio</label>
</div>
Toggles
<div class= "form-check form-switch" >
<input class= "form-check-input" type= "checkbox" id= "flexSwitchCheckDefault" checked= "" >
<label class= "form-check-label" for= "flexSwitchCheckDefault" > Checked switch</label>
</div>