Loading...

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

Basic Example

Here’s a quick example to demonstrate Bootstrap’s form styles.

We'll never share your email with anyone else.
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.

Sizing
Readonly

Add the readonly boolean attribute on an input to prevent modification of the input’s value. Read-only inputs appear lighter (just like disabled inputs), but retain the standard cursor.

Range Inputs

Set horizontally scrollable range inputs using .form-control-range.

Checkboxes and Radios

Checkboxes are for selecting one or several options in a list, while radios are for selecting one option from many.

Checkbox example:

Radio example:

Form Groups

The .form-group class is the easiest way to add some structure to forms. It provides a flexible class that encourages proper grouping of labels, controls, optional help text, and form validation messaging.

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.

Complex Layout

More complex layouts can also be created with the grid system.

Validation

Provide valuable, actionable feedback to your users with HTML5 form validation.

Looks good!
Looks good!
@
Please choose a username.
Please provide a valid city.
Please provide a valid state.
Please provide a valid zip.
You must agree before submitting.
Switches

A switch has the markup of a custom checkbox but uses the .custom-switch class to render a toggle switch. Switches also support the disabled attribute.

Select

Custom <select> menus need only a custom class, .custom-select to trigger the custom styles. Custom styles are limited to the <select>’s initial appearance and cannot modify the <option>s due to browser limitations.